1 // OpenTween - Client of Twitter
2 // Copyright (c) 2007-2011 kiri_feather (@kiri_feather) <kiri.feather@gmail.com>
3 // (c) 2008-2011 Moz (@syo68k)
4 // (c) 2008-2011 takeshik (@takeshik) <http://www.takeshik.org/>
5 // (c) 2010-2011 anis774 (@anis774) <http://d.hatena.ne.jp/anis774/>
6 // (c) 2010-2011 fantasticswallow (@f_swallow) <http://twitter.com/f_swallow>
7 // (c) 2011 kim_upsilon (@kim_upsilon) <https://upsilo.net/~upsilon/>
8 // All rights reserved.
10 // This file is part of OpenTween.
12 // This program is free software; you can redistribute it and/or modify it
13 // under the terms of the GNU General Public License as published by the Free
14 // Software Foundation; either version 3 of the License, or (at your option)
17 // This program is distributed in the hope that it will be useful, but
18 // WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
19 // or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22 // You should have received a copy of the GNU General Public License along
23 // with this program. If not, see <http://www.gnu.org/licenses/>, or write to
24 // the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor,
25 // Boston, MA 02110-1301, USA.
28 using System.Collections.Generic;
29 using System.ComponentModel;
34 using System.Windows.Forms;
35 using System.Threading;
37 using System.Resources;
39 using OpenTween.Connection;
40 using OpenTween.Thumbnail;
41 using System.Threading.Tasks;
42 using OpenTween.Setting.Panel;
46 public partial class AppendSettingDialog : OTBaseForm
48 private static AppendSettingDialog _instance = new AppendSettingDialog();
50 private ProxyType _MyProxyType;
52 private bool _ValidationError = false;
53 private MyCommon.EVENTTYPE _MyEventNotifyFlag;
54 private MyCommon.EVENTTYPE _isMyEventNotifyFlag;
55 private string _MyTranslateLanguage;
57 public bool HideDuplicatedRetweets;
59 public bool EnableImgAzyobuziNet { get; set; }
60 public bool ImgAzyobuziNetDisabledInDM { get; set; }
61 public MapProvider MapThumbnailProvider;
62 public int MapThumbnailHeight;
63 public int MapThumbnailWidth;
64 public int MapThumbnailZoom;
65 public bool IsListStatusesIncludeRts;
66 public List<UserAccount> UserAccounts;
67 private long? InitialUserId;
68 public bool TabMouseLock;
69 public bool IsRemoveSameEvent;
70 public bool IsNotifyUseGrowl;
72 public TwitterConfiguration TwitterConfiguration = TwitterConfiguration.DefaultConfiguration();
76 public event EventHandler<IntervalChangedEventArgs> IntervalChanged;
78 public void LoadConfig(SettingCommon settingCommon, SettingLocal settingLocal)
80 this.GetPeriodPanel.LoadConfig(settingCommon);
81 this.StartupPanel.LoadConfig(settingCommon);
84 public void SaveConfig(SettingCommon settingCommon, SettingLocal settingLocal)
86 this.GetPeriodPanel.SaveConfig(settingCommon);
87 this.StartupPanel.SaveConfig(settingCommon);
90 private void TreeViewSetting_BeforeSelect(object sender, TreeViewCancelEventArgs e)
92 if (this.TreeViewSetting.SelectedNode == null) return;
93 var pnl = (SettingPanelBase)this.TreeViewSetting.SelectedNode.Tag;
94 if (pnl == null) return;
99 private void TreeViewSetting_AfterSelect(object sender, TreeViewEventArgs e)
101 if (e.Node == null) return;
102 var pnl = (SettingPanelBase)e.Node.Tag;
103 if (pnl == null) return;
107 if (pnl.Name == "PreviewPanel")
109 if (GrowlHelper.IsDllExists)
111 this.PreviewPanel.IsNotifyUseGrowlCheckBox.Enabled = true;
115 this.PreviewPanel.IsNotifyUseGrowlCheckBox.Enabled = false;
120 private void Save_Click(object sender, EventArgs e)
122 if (MyCommon.IsNetworkAvailable() &&
123 (this.ShortUrlPanel.ComboBoxAutoShortUrlFirst.SelectedIndex == (int)MyCommon.UrlConverter.Bitly || this.ShortUrlPanel.ComboBoxAutoShortUrlFirst.SelectedIndex == (int)MyCommon.UrlConverter.Jmp))
125 // bit.ly 短縮機能実装のプライバシー問題の暫定対応
126 // bit.ly 使用時はログインIDとAPIキーの指定を必須とする
127 // 参照: http://sourceforge.jp/projects/opentween/lists/archive/dev/2012-January/000020.html
128 if (string.IsNullOrEmpty(this.ShortUrlPanel.TextBitlyId.Text) || string.IsNullOrEmpty(this.ShortUrlPanel.TextBitlyPw.Text))
130 MessageBox.Show("bit.ly のログイン名とAPIキーの指定は必須項目です。", Application.ProductName);
131 _ValidationError = true;
132 TreeViewSetting.SelectedNode = TreeViewSetting.Nodes["ConnectionNode"].Nodes["ShortUrlNode"]; // 動作タブを選択
133 TreeViewSetting.Select();
134 this.ShortUrlPanel.TextBitlyId.Focus();
138 if (!BitlyValidation(this.ShortUrlPanel.TextBitlyId.Text, this.ShortUrlPanel.TextBitlyPw.Text))
140 MessageBox.Show(Properties.Resources.SettingSave_ClickText1);
141 _ValidationError = true;
142 TreeViewSetting.SelectedNode = TreeViewSetting.Nodes["ConnectionNode"].Nodes["ShortUrlNode"]; // 動作タブを選択
143 TreeViewSetting.Select();
144 this.ShortUrlPanel.TextBitlyId.Focus();
149 _ValidationError = false;
154 _ValidationError = false;
157 this.UserAccounts.Clear();
158 foreach (object u in this.BasedPanel.AuthUserCombo.Items)
160 this.UserAccounts.Add((UserAccount)u);
162 if (this.BasedPanel.AuthUserCombo.SelectedIndex > -1)
164 foreach (UserAccount u in this.UserAccounts)
166 if (u.Username.ToLower() == ((UserAccount)this.BasedPanel.AuthUserCombo.SelectedItem).Username.ToLower())
168 tw.Initialize(u.Token, u.TokenSecret, u.Username, u.UserId);
171 tw.VerifyCredentials();
172 u.UserId = tw.UserId;
181 tw.Initialize("", "", "", 0);
186 if (this.FollowCheckBox.Checked)
189 HttpConnection.ProxyType ptype;
190 if (RadioProxyNone.Checked)
192 ptype = HttpConnection.ProxyType.None;
194 else if (RadioProxyIE.Checked)
196 ptype = HttpConnection.ProxyType.IE;
200 ptype = HttpConnection.ProxyType.Specified;
202 string padr = TextProxyAddress.Text.Trim();
203 int pport = int.Parse(TextProxyPort.Text.Trim());
204 string pusr = TextProxyUser.Text.Trim();
205 string ppw = TextProxyPassword.Text.Trim();
206 HttpConnection.InitializeConnection(20, ptype, padr, pport, pusr, ppw);
208 string ret = tw.PostFollowCommand(ApplicationSettings.FeedbackTwitterName);
213 switch (this.TweetPrvPanel.IconSize.SelectedIndex)
216 IconSz = MyCommon.IconSizes.IconNone;
219 IconSz = MyCommon.IconSizes.Icon16;
222 IconSz = MyCommon.IconSizes.Icon24;
225 IconSz = MyCommon.IconSizes.Icon48;
228 IconSz = MyCommon.IconSizes.Icon48_2;
231 Status = this.TweetActPanel.StatusText.Text;
232 PlaySound = this.ActionPanel.PlaySnd.Checked;
233 UnreadManage = this.ActionPanel.UReadMng.Checked;
234 OneWayLove = this.TweetPrvPanel.OneWayLv.Checked;
236 FontUnread = this.FontPanel.lblUnread.Font; //未使用
237 ColorUnread = this.FontPanel.lblUnread.ForeColor;
238 FontReaded = this.FontPanel.lblListFont.Font; //リストフォントとして使用
239 ColorReaded = this.FontPanel.lblListFont.ForeColor;
240 ColorFav = this.FontPanel.lblFav.ForeColor;
241 ColorOWL = this.FontPanel.lblOWL.ForeColor;
242 ColorRetweet = this.FontPanel.lblRetweet.ForeColor;
243 FontDetail = this.FontPanel.lblDetail.Font;
244 ColorSelf = this.FontPanel2.lblSelf.BackColor;
245 ColorAtSelf = this.FontPanel2.lblAtSelf.BackColor;
246 ColorTarget = this.FontPanel2.lblTarget.BackColor;
247 ColorAtTarget = this.FontPanel2.lblAtTarget.BackColor;
248 ColorAtFromTarget = this.FontPanel2.lblAtFromTarget.BackColor;
249 ColorAtTo = this.FontPanel2.lblAtTo.BackColor;
250 ColorInputBackcolor = this.FontPanel2.lblInputBackcolor.BackColor;
251 ColorInputFont = this.FontPanel2.lblInputFont.ForeColor;
252 ColorListBackcolor = this.FontPanel2.lblListBackcolor.BackColor;
253 ColorDetailBackcolor = this.FontPanel.lblDetailBackcolor.BackColor;
254 ColorDetail = this.FontPanel.lblDetail.ForeColor;
255 ColorDetailLink = this.FontPanel.lblDetailLink.ForeColor;
256 FontInputFont = this.FontPanel2.lblInputFont.Font;
257 switch (this.PreviewPanel.cmbNameBalloon.SelectedIndex)
260 NameBalloon = MyCommon.NameBalloonEnum.None;
263 NameBalloon = MyCommon.NameBalloonEnum.UserID;
266 NameBalloon = MyCommon.NameBalloonEnum.NickName;
270 switch (this.TweetActPanel.ComboBoxPostKeySelect.SelectedIndex)
273 PostShiftEnter = true;
274 PostCtrlEnter = false;
277 PostCtrlEnter = true;
278 PostShiftEnter = false;
281 PostCtrlEnter = false;
282 PostShiftEnter = false;
285 CountApi = int.Parse(this.GetCountPanel.TextCountApi.Text);
286 CountApiReply = int.Parse(this.GetCountPanel.TextCountApiReply.Text);
287 BrowserPath = this.ActionPanel.BrowserPathText.Text.Trim();
288 UseRecommendStatus = this.TweetActPanel.CheckUseRecommendStatus.Checked;
289 DispUsername = this.PreviewPanel.CheckDispUsername.Checked;
290 CloseToExit = this.ActionPanel.CheckCloseToExit.Checked;
291 MinimizeToTray = this.ActionPanel.CheckMinimizeToTray.Checked;
292 switch (this.PreviewPanel.ComboDispTitle.SelectedIndex)
295 DispLatestPost = MyCommon.DispTitleEnum.None;
298 DispLatestPost = MyCommon.DispTitleEnum.Ver;
301 DispLatestPost = MyCommon.DispTitleEnum.Post;
304 DispLatestPost = MyCommon.DispTitleEnum.UnreadRepCount;
307 DispLatestPost = MyCommon.DispTitleEnum.UnreadAllCount;
310 DispLatestPost = MyCommon.DispTitleEnum.UnreadAllRepCount;
313 DispLatestPost = MyCommon.DispTitleEnum.UnreadCountAllCount;
315 case 7: //Count of Status/Follow/Follower
316 DispLatestPost = MyCommon.DispTitleEnum.OwnStatus;
319 SortOrderLock = this.TweetPrvPanel.CheckSortOrderLock.Checked;
320 ViewTabBottom = this.TweetPrvPanel.CheckViewTabBottom.Checked;
321 TinyUrlResolve = this.ShortUrlPanel.CheckTinyURL.Checked;
322 ShortUrl.Instance.DisableExpanding = !TinyUrlResolve;
323 if (this.ProxyPanel.RadioProxyNone.Checked)
325 _MyProxyType = ProxyType.None;
327 else if (this.ProxyPanel.RadioProxyIE.Checked)
329 _MyProxyType = ProxyType.IE;
333 _MyProxyType = ProxyType.Specified;
335 ProxyAddress = this.ProxyPanel.TextProxyAddress.Text.Trim();
336 ProxyPort = int.Parse(this.ProxyPanel.TextProxyPort.Text.Trim());
337 ProxyUser = this.ProxyPanel.TextProxyUser.Text.Trim();
338 ProxyPassword = this.ProxyPanel.TextProxyPassword.Text.Trim();
339 RestrictFavCheck = this.ActionPanel.CheckFavRestrict.Checked;
340 AlwaysTop = this.PreviewPanel.CheckAlwaysTop.Checked;
341 UrlConvertAuto = this.ShortUrlPanel.CheckAutoConvertUrl.Checked;
342 ShortenTco = this.ShortUrlPanel.ShortenTcoCheck.Checked;
344 Nicoms = this.CooperatePanel.CheckNicoms.Checked;
345 UseUnreadStyle = this.TweetPrvPanel.chkUnreadStyle.Checked;
346 DateTimeFormat = this.TweetPrvPanel.CmbDateTimeFormat.Text;
347 DefaultTimeOut = int.Parse(this.ConnectionPanel.ConnectionTimeOut.Text);
348 RetweetNoConfirm = this.TweetActPanel.CheckRetweetNoConfirm.Checked;
349 LimitBalloon = this.PreviewPanel.CheckBalloonLimit.Checked;
350 EventNotifyEnabled = this.NotifyPanel.CheckEventNotify.Checked;
351 GetEventNotifyFlag(ref _MyEventNotifyFlag, ref _isMyEventNotifyFlag);
352 ForceEventNotify = this.NotifyPanel.CheckForceEventNotify.Checked;
353 FavEventUnread = this.NotifyPanel.CheckFavEventUnread.Checked;
354 TranslateLanguage = Bing.GetLanguageEnumFromIndex(this.CooperatePanel.ComboBoxTranslateLanguage.SelectedIndex);
355 EventSoundFile = (string)this.NotifyPanel.ComboBoxEventNotifySound.SelectedItem;
356 AutoShortUrlFirst = (MyCommon.UrlConverter)this.ShortUrlPanel.ComboBoxAutoShortUrlFirst.SelectedIndex;
357 TabIconDisp = this.PreviewPanel.chkTabIconDisp.Checked;
358 ReadOwnPost = this.ActionPanel.chkReadOwnPost.Checked;
359 IsMonospace = this.PreviewPanel.CheckMonospace.Checked;
360 ReadOldPosts = this.ActionPanel.CheckReadOldPosts.Checked;
361 BitlyUser = this.ShortUrlPanel.TextBitlyId.Text;
362 BitlyPwd = this.ShortUrlPanel.TextBitlyPw.Text;
363 ShowGrid = this.TweetPrvPanel.CheckShowGrid.Checked;
364 UseAtIdSupplement = this.TweetActPanel.CheckAtIdSupple.Checked;
365 UseHashSupplement = this.TweetActPanel.CheckHashSupple.Checked;
366 PreviewEnable = this.PreviewPanel.CheckPreviewEnable.Checked;
367 StatusAreaAtBottom = this.PreviewPanel.CheckStatusAreaAtBottom.Checked;
368 TwitterApiUrl = this.ConnectionPanel.TwitterAPIText.Text.Trim();
369 switch (this.PreviewPanel.ReplyIconStateCombo.SelectedIndex)
372 ReplyIconState = MyCommon.REPLY_ICONSTATE.None;
375 ReplyIconState = MyCommon.REPLY_ICONSTATE.StaticIcon;
378 ReplyIconState = MyCommon.REPLY_ICONSTATE.BlinkIcon;
381 switch (this.PreviewPanel.LanguageCombo.SelectedIndex)
399 HotkeyEnabled = this.ActionPanel.HotkeyCheck.Checked;
400 HotkeyMod = Keys.None;
401 if (this.ActionPanel.HotkeyAlt.Checked) HotkeyMod = HotkeyMod | Keys.Alt;
402 if (this.ActionPanel.HotkeyShift.Checked) HotkeyMod = HotkeyMod | Keys.Shift;
403 if (this.ActionPanel.HotkeyCtrl.Checked) HotkeyMod = HotkeyMod | Keys.Control;
404 if (this.ActionPanel.HotkeyWin.Checked) HotkeyMod = HotkeyMod | Keys.LWin;
405 int.TryParse(this.ActionPanel.HotkeyCode.Text, out HotkeyValue);
406 HotkeyKey = (Keys)this.ActionPanel.HotkeyText.Tag;
407 BlinkNewMentions = this.PreviewPanel.ChkNewMentionsBlink.Checked;
408 UseAdditionalCount = this.GetCountPanel.UseChangeGetCount.Checked;
409 MoreCountApi = int.Parse(this.GetCountPanel.GetMoreTextCountApi.Text);
410 FirstCountApi = int.Parse(this.GetCountPanel.FirstTextCountApi.Text);
411 SearchCountApi = int.Parse(this.GetCountPanel.SearchTextCountApi.Text);
412 FavoritesCountApi = int.Parse(this.GetCountPanel.FavoritesTextCountApi.Text);
413 UserTimelineCountApi = int.Parse(this.GetCountPanel.UserTimelineTextCountApi.Text);
414 ListCountApi = int.Parse(this.GetCountPanel.ListTextCountApi.Text);
415 OpenUserTimeline = this.ActionPanel.CheckOpenUserTimeline.Checked;
416 ListDoubleClickAction = this.ActionPanel.ListDoubleClickActionComboBox.SelectedIndex;
417 UserAppointUrl = this.CooperatePanel.UserAppointUrlText.Text;
418 this.HideDuplicatedRetweets = this.TweetPrvPanel.HideDuplicatedRetweetsCheck.Checked;
419 this.EnableImgAzyobuziNet = this.CooperatePanel.EnableImgAzyobuziNetCheckBox.Checked;
420 this.ImgAzyobuziNetDisabledInDM = this.CooperatePanel.ImgAzyobuziNetDisabledInDMCheckBox.Checked;
421 this.MapThumbnailProvider = (MapProvider)this.CooperatePanel.MapThumbnailProviderComboBox.SelectedIndex;
422 this.MapThumbnailHeight = int.Parse(this.CooperatePanel.MapThumbnailHeightTextBox.Text);
423 this.MapThumbnailWidth = int.Parse(this.CooperatePanel.MapThumbnailWidthTextBox.Text);
424 this.MapThumbnailZoom = int.Parse(this.CooperatePanel.MapThumbnailZoomTextBox.Text);
425 this.IsListStatusesIncludeRts = this.TweetPrvPanel.IsListsIncludeRtsCheckBox.Checked;
426 this.TabMouseLock = this.ActionPanel.TabMouseLockCheck.Checked;
427 this.IsRemoveSameEvent = this.NotifyPanel.IsRemoveSameFavEventCheckBox.Checked;
428 this.IsNotifyUseGrowl = this.PreviewPanel.IsNotifyUseGrowlCheckBox.Checked;
432 MessageBox.Show(Properties.Resources.Save_ClickText3);
433 this.DialogResult = DialogResult.Cancel;
438 private void Setting_FormClosing(object sender, FormClosingEventArgs e)
440 if (MyCommon._endingFlag) return;
442 if (this.DialogResult == DialogResult.Cancel)
444 //キャンセル時は画面表示時のアカウントに戻す
445 //キャンセル時でも認証済みアカウント情報は保存する
446 this.UserAccounts.Clear();
447 foreach (object u in this.BasedPanel.AuthUserCombo.Items)
449 this.UserAccounts.Add((UserAccount)u);
451 //アクティブユーザーを起動時のアカウントに戻す(起動時アカウントなければ何もしない)
452 bool userSet = false;
453 if (this.InitialUserId != null)
455 foreach (UserAccount u in this.UserAccounts)
457 if (u.UserId == this.InitialUserId)
459 tw.Initialize(u.Token, u.TokenSecret, u.Username, u.UserId);
465 //認証済みアカウントが削除されていた場合、もしくは起動時アカウントがなかった場合は、
470 tw.Initialize("", "", "", 0);
474 if (tw != null && string.IsNullOrEmpty(tw.Username) && e.CloseReason == CloseReason.None)
476 if (MessageBox.Show(Properties.Resources.Setting_FormClosing1, "Confirm", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.Cancel)
481 if (_ValidationError)
485 if (e.Cancel == false && TreeViewSetting.SelectedNode != null)
487 var curPanel = (SettingPanelBase)TreeViewSetting.SelectedNode.Tag;
488 curPanel.Visible = false;
489 curPanel.Enabled = false;
493 private void Setting_Load(object sender, EventArgs e)
495 tw = ((TweenMain)this.Owner).TwitterInstance;
496 //this.AuthStateLabel.Enabled = true;
497 //this.AuthUserLabel.Enabled = true;
498 this.BasedPanel.AuthClearButton.Enabled = true;
500 //if (tw.Username == "")
502 // //this.AuthStateLabel.Text = Properties.Resources.AuthorizeButton_Click4
503 // //this.AuthUserLabel.Text = ""
504 // //this.Save.Enabled = false
508 // //this.AuthStateLabel.Text = Properties.Resources.AuthorizeButton_Click3;
509 // //if (TwitterApiInfo.AccessLevel == ApiAccessLevel.ReadWrite)
511 // // this.AuthStateLabel.Text += "(xAuth)";
513 // //else if (TwitterApiInfo.AccessLevel == ApiAccessLevel.ReadWriteAndDirectMessage)
515 // // this.AuthStateLabel.Text += "(OAuth)";
517 // //this.AuthUserLabel.Text = tw.Username;
520 this.BasedPanel.AuthUserCombo.Items.Clear();
521 if (this.UserAccounts.Count > 0)
523 this.BasedPanel.AuthUserCombo.Items.AddRange(this.UserAccounts.ToArray());
524 foreach (UserAccount u in this.UserAccounts)
526 if (u.UserId == tw.UserId)
528 this.BasedPanel.AuthUserCombo.SelectedItem = u;
529 this.InitialUserId = u.UserId;
537 case MyCommon.IconSizes.IconNone:
538 this.TweetPrvPanel.IconSize.SelectedIndex = 0;
540 case MyCommon.IconSizes.Icon16:
541 this.TweetPrvPanel.IconSize.SelectedIndex = 1;
543 case MyCommon.IconSizes.Icon24:
544 this.TweetPrvPanel.IconSize.SelectedIndex = 2;
546 case MyCommon.IconSizes.Icon48:
547 this.TweetPrvPanel.IconSize.SelectedIndex = 3;
549 case MyCommon.IconSizes.Icon48_2:
550 this.TweetPrvPanel.IconSize.SelectedIndex = 4;
553 this.TweetActPanel.StatusText.Text = Status;
554 this.ActionPanel.UReadMng.Checked = UnreadManage;
555 this.ActionPanel.PlaySnd.Checked = PlaySound;
556 this.TweetPrvPanel.OneWayLv.Checked = OneWayLove;
558 this.FontPanel.lblListFont.Font = FontReaded;
559 this.FontPanel.lblUnread.Font = FontUnread;
560 this.FontPanel.lblUnread.ForeColor = ColorUnread;
561 this.FontPanel.lblListFont.ForeColor = ColorReaded;
562 this.FontPanel.lblFav.ForeColor = ColorFav;
563 this.FontPanel.lblOWL.ForeColor = ColorOWL;
564 this.FontPanel.lblRetweet.ForeColor = ColorRetweet;
565 this.FontPanel.lblDetail.Font = FontDetail;
566 this.FontPanel2.lblSelf.BackColor = ColorSelf;
567 this.FontPanel2.lblAtSelf.BackColor = ColorAtSelf;
568 this.FontPanel2.lblTarget.BackColor = ColorTarget;
569 this.FontPanel2.lblAtTarget.BackColor = ColorAtTarget;
570 this.FontPanel2.lblAtFromTarget.BackColor = ColorAtFromTarget;
571 this.FontPanel2.lblAtTo.BackColor = ColorAtTo;
572 this.FontPanel2.lblInputBackcolor.BackColor = ColorInputBackcolor;
573 this.FontPanel2.lblInputFont.ForeColor = ColorInputFont;
574 this.FontPanel2.lblInputFont.Font = FontInputFont;
575 this.FontPanel2.lblListBackcolor.BackColor = ColorListBackcolor;
576 this.FontPanel.lblDetailBackcolor.BackColor = ColorDetailBackcolor;
577 this.FontPanel.lblDetail.ForeColor = ColorDetail;
578 this.FontPanel.lblDetailLink.ForeColor = ColorDetailLink;
582 case MyCommon.NameBalloonEnum.None:
583 this.PreviewPanel.cmbNameBalloon.SelectedIndex = 0;
585 case MyCommon.NameBalloonEnum.UserID:
586 this.PreviewPanel.cmbNameBalloon.SelectedIndex = 1;
588 case MyCommon.NameBalloonEnum.NickName:
589 this.PreviewPanel.cmbNameBalloon.SelectedIndex = 2;
595 this.TweetActPanel.ComboBoxPostKeySelect.SelectedIndex = 1;
597 else if (PostShiftEnter)
599 this.TweetActPanel.ComboBoxPostKeySelect.SelectedIndex = 2;
603 this.TweetActPanel.ComboBoxPostKeySelect.SelectedIndex = 0;
606 this.GetCountPanel.TextCountApi.Text = CountApi.ToString();
607 this.GetCountPanel.TextCountApiReply.Text = CountApiReply.ToString();
608 this.ActionPanel.BrowserPathText.Text = BrowserPath;
609 this.TweetActPanel.CheckUseRecommendStatus.Checked = UseRecommendStatus;
610 this.PreviewPanel.CheckDispUsername.Checked = DispUsername;
611 this.ActionPanel.CheckCloseToExit.Checked = CloseToExit;
612 this.ActionPanel.CheckMinimizeToTray.Checked = MinimizeToTray;
613 switch (DispLatestPost)
615 case MyCommon.DispTitleEnum.None:
616 this.PreviewPanel.ComboDispTitle.SelectedIndex = 0;
618 case MyCommon.DispTitleEnum.Ver:
619 this.PreviewPanel.ComboDispTitle.SelectedIndex = 1;
621 case MyCommon.DispTitleEnum.Post:
622 this.PreviewPanel.ComboDispTitle.SelectedIndex = 2;
624 case MyCommon.DispTitleEnum.UnreadRepCount:
625 this.PreviewPanel.ComboDispTitle.SelectedIndex = 3;
627 case MyCommon.DispTitleEnum.UnreadAllCount:
628 this.PreviewPanel.ComboDispTitle.SelectedIndex = 4;
630 case MyCommon.DispTitleEnum.UnreadAllRepCount:
631 this.PreviewPanel.ComboDispTitle.SelectedIndex = 5;
633 case MyCommon.DispTitleEnum.UnreadCountAllCount:
634 this.PreviewPanel.ComboDispTitle.SelectedIndex = 6;
636 case MyCommon.DispTitleEnum.OwnStatus:
637 this.PreviewPanel.ComboDispTitle.SelectedIndex = 7;
640 this.TweetPrvPanel.CheckSortOrderLock.Checked = SortOrderLock;
641 this.TweetPrvPanel.CheckViewTabBottom.Checked = ViewTabBottom;
642 this.ShortUrlPanel.CheckTinyURL.Checked = TinyUrlResolve;
643 switch (_MyProxyType)
646 this.ProxyPanel.RadioProxyNone.Checked = true;
649 this.ProxyPanel.RadioProxyIE.Checked = true;
652 this.ProxyPanel.RadioProxySpecified.Checked = true;
655 bool chk = this.ProxyPanel.RadioProxySpecified.Checked;
656 this.ProxyPanel.LabelProxyAddress.Enabled = chk;
657 this.ProxyPanel.TextProxyAddress.Enabled = chk;
658 this.ProxyPanel.LabelProxyPort.Enabled = chk;
659 this.ProxyPanel.TextProxyPort.Enabled = chk;
660 this.ProxyPanel.LabelProxyUser.Enabled = chk;
661 this.ProxyPanel.TextProxyUser.Enabled = chk;
662 this.ProxyPanel.LabelProxyPassword.Enabled = chk;
663 this.ProxyPanel.TextProxyPassword.Enabled = chk;
665 this.ProxyPanel.TextProxyAddress.Text = ProxyAddress;
666 this.ProxyPanel.TextProxyPort.Text = ProxyPort.ToString();
667 this.ProxyPanel.TextProxyUser.Text = ProxyUser;
668 this.ProxyPanel.TextProxyPassword.Text = ProxyPassword;
670 this.ActionPanel.CheckFavRestrict.Checked = RestrictFavCheck;
671 this.PreviewPanel.CheckAlwaysTop.Checked = AlwaysTop;
672 this.ShortUrlPanel.CheckAutoConvertUrl.Checked = UrlConvertAuto;
673 this.ShortUrlPanel.ShortenTcoCheck.Checked = ShortenTco;
674 this.ShortUrlPanel.ShortenTcoCheck.Enabled = this.ShortUrlPanel.CheckAutoConvertUrl.Checked;
676 this.CooperatePanel.CheckNicoms.Checked = Nicoms;
677 this.TweetPrvPanel.chkUnreadStyle.Checked = UseUnreadStyle;
678 this.TweetPrvPanel.CmbDateTimeFormat.Text = DateTimeFormat;
679 this.ConnectionPanel.ConnectionTimeOut.Text = DefaultTimeOut.ToString();
680 this.TweetActPanel.CheckRetweetNoConfirm.Checked = RetweetNoConfirm;
681 this.PreviewPanel.CheckBalloonLimit.Checked = LimitBalloon;
683 ApplyEventNotifyFlag(EventNotifyEnabled, EventNotifyFlag, IsMyEventNotifyFlag);
684 this.NotifyPanel.CheckForceEventNotify.Checked = ForceEventNotify;
685 this.NotifyPanel.CheckFavEventUnread.Checked = FavEventUnread;
686 this.CooperatePanel.ComboBoxTranslateLanguage.SelectedIndex = Bing.GetIndexFromLanguageEnum(TranslateLanguage);
688 this.ShortUrlPanel.ComboBoxAutoShortUrlFirst.SelectedIndex = (int)AutoShortUrlFirst;
689 this.PreviewPanel.chkTabIconDisp.Checked = TabIconDisp;
690 this.ActionPanel.chkReadOwnPost.Checked = ReadOwnPost;
691 this.PreviewPanel.CheckMonospace.Checked = IsMonospace;
692 this.ActionPanel.CheckReadOldPosts.Checked = ReadOldPosts;
693 this.ShortUrlPanel.TextBitlyId.Text = BitlyUser;
694 this.ShortUrlPanel.TextBitlyPw.Text = BitlyPwd;
695 this.ShortUrlPanel.TextBitlyId.Modified = false;
696 this.ShortUrlPanel.TextBitlyPw.Modified = false;
697 this.TweetPrvPanel.CheckShowGrid.Checked = ShowGrid;
698 this.TweetActPanel.CheckAtIdSupple.Checked = UseAtIdSupplement;
699 this.TweetActPanel.CheckHashSupple.Checked = UseHashSupplement;
700 this.PreviewPanel.CheckPreviewEnable.Checked = PreviewEnable;
701 this.PreviewPanel.CheckStatusAreaAtBottom.Checked = StatusAreaAtBottom;
702 this.ConnectionPanel.TwitterAPIText.Text = TwitterApiUrl;
703 switch (ReplyIconState)
705 case MyCommon.REPLY_ICONSTATE.None:
706 this.PreviewPanel.ReplyIconStateCombo.SelectedIndex = 0;
708 case MyCommon.REPLY_ICONSTATE.StaticIcon:
709 this.PreviewPanel.ReplyIconStateCombo.SelectedIndex = 1;
711 case MyCommon.REPLY_ICONSTATE.BlinkIcon:
712 this.PreviewPanel.ReplyIconStateCombo.SelectedIndex = 2;
718 this.PreviewPanel.LanguageCombo.SelectedIndex = 0;
721 this.PreviewPanel.LanguageCombo.SelectedIndex = 1;
724 this.PreviewPanel.LanguageCombo.SelectedIndex = 2;
727 this.PreviewPanel.LanguageCombo.SelectedIndex = 3;
730 this.PreviewPanel.LanguageCombo.SelectedIndex = 0;
733 this.ActionPanel.HotkeyCheck.Checked = HotkeyEnabled;
734 this.ActionPanel.HotkeyAlt.Checked = ((HotkeyMod & Keys.Alt) == Keys.Alt);
735 this.ActionPanel.HotkeyCtrl.Checked = ((HotkeyMod & Keys.Control) == Keys.Control);
736 this.ActionPanel.HotkeyShift.Checked = ((HotkeyMod & Keys.Shift) == Keys.Shift);
737 this.ActionPanel.HotkeyWin.Checked = ((HotkeyMod & Keys.LWin) == Keys.LWin);
738 this.ActionPanel.HotkeyCode.Text = HotkeyValue.ToString();
739 this.ActionPanel.HotkeyText.Text = HotkeyKey.ToString();
740 this.ActionPanel.HotkeyText.Tag = HotkeyKey;
741 this.ActionPanel.HotkeyAlt.Enabled = HotkeyEnabled;
742 this.ActionPanel.HotkeyShift.Enabled = HotkeyEnabled;
743 this.ActionPanel.HotkeyCtrl.Enabled = HotkeyEnabled;
744 this.ActionPanel.HotkeyWin.Enabled = HotkeyEnabled;
745 this.ActionPanel.HotkeyText.Enabled = HotkeyEnabled;
746 this.ActionPanel.HotkeyCode.Enabled = HotkeyEnabled;
747 this.PreviewPanel.ChkNewMentionsBlink.Checked = BlinkNewMentions;
749 this.GetCountPanel.GetMoreTextCountApi.Text = MoreCountApi.ToString();
750 this.GetCountPanel.FirstTextCountApi.Text = FirstCountApi.ToString();
751 this.GetCountPanel.SearchTextCountApi.Text = SearchCountApi.ToString();
752 this.GetCountPanel.FavoritesTextCountApi.Text = FavoritesCountApi.ToString();
753 this.GetCountPanel.UserTimelineTextCountApi.Text = UserTimelineCountApi.ToString();
754 this.GetCountPanel.ListTextCountApi.Text = ListCountApi.ToString();
755 this.GetCountPanel.UseChangeGetCount.Checked = UseAdditionalCount;
756 this.GetCountPanel.Label28.Enabled = this.GetCountPanel.UseChangeGetCount.Checked;
757 this.GetCountPanel.Label30.Enabled = this.GetCountPanel.UseChangeGetCount.Checked;
758 this.GetCountPanel.Label53.Enabled = this.GetCountPanel.UseChangeGetCount.Checked;
759 this.GetCountPanel.Label66.Enabled = this.GetCountPanel.UseChangeGetCount.Checked;
760 this.GetCountPanel.Label17.Enabled = this.GetCountPanel.UseChangeGetCount.Checked;
761 this.GetCountPanel.Label25.Enabled = this.GetCountPanel.UseChangeGetCount.Checked;
762 this.GetCountPanel.GetMoreTextCountApi.Enabled = this.GetCountPanel.UseChangeGetCount.Checked;
763 this.GetCountPanel.FirstTextCountApi.Enabled = this.GetCountPanel.UseChangeGetCount.Checked;
764 this.GetCountPanel.SearchTextCountApi.Enabled = this.GetCountPanel.UseChangeGetCount.Checked;
765 this.GetCountPanel.FavoritesTextCountApi.Enabled = this.GetCountPanel.UseChangeGetCount.Checked;
766 this.GetCountPanel.UserTimelineTextCountApi.Enabled = this.GetCountPanel.UseChangeGetCount.Checked;
767 this.GetCountPanel.ListTextCountApi.Enabled = this.GetCountPanel.UseChangeGetCount.Checked;
768 this.ActionPanel.CheckOpenUserTimeline.Checked = OpenUserTimeline;
769 this.ActionPanel.ListDoubleClickActionComboBox.SelectedIndex = ListDoubleClickAction;
770 this.CooperatePanel.UserAppointUrlText.Text = UserAppointUrl;
771 this.TweetPrvPanel.HideDuplicatedRetweetsCheck.Checked = this.HideDuplicatedRetweets;
772 this.CooperatePanel.EnableImgAzyobuziNetCheckBox.Checked = this.EnableImgAzyobuziNet;
773 this.CooperatePanel.ImgAzyobuziNetDisabledInDMCheckBox.Checked = this.ImgAzyobuziNetDisabledInDM;
774 this.CooperatePanel.MapThumbnailProviderComboBox.SelectedIndex = (int)this.MapThumbnailProvider;
775 this.CooperatePanel.MapThumbnailHeightTextBox.Text = this.MapThumbnailHeight.ToString();
776 this.CooperatePanel.MapThumbnailWidthTextBox.Text = this.MapThumbnailWidth.ToString();
777 this.CooperatePanel.MapThumbnailZoomTextBox.Text = this.MapThumbnailZoom.ToString();
778 this.TweetPrvPanel.IsListsIncludeRtsCheckBox.Checked = this.IsListStatusesIncludeRts;
779 this.ActionPanel.TabMouseLockCheck.Checked = this.TabMouseLock;
780 this.NotifyPanel.IsRemoveSameFavEventCheckBox.Checked = this.IsRemoveSameEvent;
781 this.PreviewPanel.IsNotifyUseGrowlCheckBox.Checked = this.IsNotifyUseGrowl;
783 if (GrowlHelper.IsDllExists)
785 this.PreviewPanel.IsNotifyUseGrowlCheckBox.Enabled = true;
789 this.PreviewPanel.IsNotifyUseGrowlCheckBox.Enabled = false;
792 this.TreeViewSetting.Nodes["BasedNode"].Tag = BasedPanel;
793 this.TreeViewSetting.Nodes["BasedNode"].Nodes["PeriodNode"].Tag = GetPeriodPanel;
794 this.TreeViewSetting.Nodes["BasedNode"].Nodes["StartUpNode"].Tag = StartupPanel;
795 this.TreeViewSetting.Nodes["BasedNode"].Nodes["GetCountNode"].Tag = GetCountPanel;
796 //this.TreeViewSetting.Nodes["BasedNode"].Nodes["UserStreamNode"].Tag = UserStreamPanel;
797 this.TreeViewSetting.Nodes["ActionNode"].Tag = ActionPanel;
798 this.TreeViewSetting.Nodes["ActionNode"].Nodes["TweetActNode"].Tag = TweetActPanel;
799 this.TreeViewSetting.Nodes["PreviewNode"].Tag = PreviewPanel;
800 this.TreeViewSetting.Nodes["PreviewNode"].Nodes["TweetPrvNode"].Tag = TweetPrvPanel;
801 this.TreeViewSetting.Nodes["PreviewNode"].Nodes["NotifyNode"].Tag = NotifyPanel;
802 this.TreeViewSetting.Nodes["FontNode"].Tag = FontPanel;
803 this.TreeViewSetting.Nodes["FontNode"].Nodes["FontNode2"].Tag = FontPanel2;
804 this.TreeViewSetting.Nodes["ConnectionNode"].Tag = ConnectionPanel;
805 this.TreeViewSetting.Nodes["ConnectionNode"].Nodes["ProxyNode"].Tag = ProxyPanel;
806 this.TreeViewSetting.Nodes["ConnectionNode"].Nodes["CooperateNode"].Tag = CooperatePanel;
807 this.TreeViewSetting.Nodes["ConnectionNode"].Nodes["ShortUrlNode"].Tag = ShortUrlPanel;
809 this.TreeViewSetting.SelectedNode = this.TreeViewSetting.Nodes[0];
810 this.TreeViewSetting.ExpandAll();
812 //TreeViewSetting.SelectedNode = TreeViewSetting.TopNode;
813 ActiveControl = BasedPanel.StartAuthButton;
816 private void UReadMng_CheckedChanged(object sender, EventArgs e)
818 if (this.ActionPanel.UReadMng.Checked == true)
820 this.StartupPanel.StartupReaded.Enabled = true;
824 this.StartupPanel.StartupReaded.Enabled = false;
828 private void btnFontAndColor_Click(object sender, EventArgs e) // Handles btnUnread.Click, btnDetail.Click, btnListFont.Click, btnInputFont.Click
830 Button Btn = (Button) sender;
833 FontDialog1.AllowVerticalFonts = false;
834 FontDialog1.AllowScriptChange = true;
835 FontDialog1.AllowSimulations = true;
836 FontDialog1.AllowVectorFonts = true;
837 FontDialog1.FixedPitchOnly = false;
838 FontDialog1.FontMustExist = true;
839 FontDialog1.ScriptsOnly = false;
840 FontDialog1.ShowApply = false;
841 FontDialog1.ShowEffects = true;
842 FontDialog1.ShowColor = true;
847 FontDialog1.Color = this.FontPanel.lblUnread.ForeColor;
848 FontDialog1.Font = this.FontPanel.lblUnread.Font;
851 FontDialog1.Color = this.FontPanel.lblDetail.ForeColor;
852 FontDialog1.Font = this.FontPanel.lblDetail.Font;
855 FontDialog1.Color = this.FontPanel.lblListFont.ForeColor;
856 FontDialog1.Font = this.FontPanel.lblListFont.Font;
859 FontDialog1.Color = this.FontPanel2.lblInputFont.ForeColor;
860 FontDialog1.Font = this.FontPanel2.lblInputFont.Font;
866 rtn = FontDialog1.ShowDialog();
868 catch(ArgumentException ex)
870 MessageBox.Show(ex.Message);
874 if (rtn == DialogResult.Cancel) return;
879 this.FontPanel.lblUnread.ForeColor = FontDialog1.Color;
880 this.FontPanel.lblUnread.Font = FontDialog1.Font;
883 this.FontPanel.lblDetail.ForeColor = FontDialog1.Color;
884 this.FontPanel.lblDetail.Font = FontDialog1.Font;
887 this.FontPanel.lblListFont.ForeColor = FontDialog1.Color;
888 this.FontPanel.lblListFont.Font = FontDialog1.Font;
891 this.FontPanel2.lblInputFont.ForeColor = FontDialog1.Color;
892 this.FontPanel2.lblInputFont.Font = FontDialog1.Font;
898 private void btnColor_Click(object sender, EventArgs e) //Handles btnSelf.Click, btnAtSelf.Click, btnTarget.Click, btnAtTarget.Click, btnAtFromTarget.Click, btnFav.Click, btnOWL.Click, btnInputBackcolor.Click, btnAtTo.Click, btnListBack.Click, btnDetailBack.Click, btnDetailLink.Click, btnRetweet.Click
900 Button Btn = (Button)sender;
903 ColorDialog1.AllowFullOpen = true;
904 ColorDialog1.AnyColor = true;
905 ColorDialog1.FullOpen = false;
906 ColorDialog1.SolidColorOnly = false;
911 ColorDialog1.Color = this.FontPanel2.lblSelf.BackColor;
914 ColorDialog1.Color = this.FontPanel2.lblAtSelf.BackColor;
917 ColorDialog1.Color = this.FontPanel2.lblTarget.BackColor;
920 ColorDialog1.Color = this.FontPanel2.lblAtTarget.BackColor;
922 case "btnAtFromTarget":
923 ColorDialog1.Color = this.FontPanel2.lblAtFromTarget.BackColor;
926 ColorDialog1.Color = this.FontPanel.lblFav.ForeColor;
929 ColorDialog1.Color = this.FontPanel.lblOWL.ForeColor;
932 ColorDialog1.Color = this.FontPanel.lblRetweet.ForeColor;
934 case "btnInputBackcolor":
935 ColorDialog1.Color = this.FontPanel2.lblInputBackcolor.BackColor;
938 ColorDialog1.Color = this.FontPanel2.lblAtTo.BackColor;
941 ColorDialog1.Color = this.FontPanel2.lblListBackcolor.BackColor;
943 case "btnDetailBack":
944 ColorDialog1.Color = this.FontPanel.lblDetailBackcolor.BackColor;
946 case "btnDetailLink":
947 ColorDialog1.Color = this.FontPanel.lblDetailLink.ForeColor;
951 rtn = ColorDialog1.ShowDialog();
953 if (rtn == DialogResult.Cancel) return;
958 this.FontPanel2.lblSelf.BackColor = ColorDialog1.Color;
961 this.FontPanel2.lblAtSelf.BackColor = ColorDialog1.Color;
964 this.FontPanel2.lblTarget.BackColor = ColorDialog1.Color;
967 this.FontPanel2.lblAtTarget.BackColor = ColorDialog1.Color;
969 case "btnAtFromTarget":
970 this.FontPanel2.lblAtFromTarget.BackColor = ColorDialog1.Color;
973 this.FontPanel.lblFav.ForeColor = ColorDialog1.Color;
976 this.FontPanel.lblOWL.ForeColor = ColorDialog1.Color;
979 this.FontPanel.lblRetweet.ForeColor = ColorDialog1.Color;
981 case "btnInputBackcolor":
982 this.FontPanel2.lblInputBackcolor.BackColor = ColorDialog1.Color;
985 this.FontPanel2.lblAtTo.BackColor = ColorDialog1.Color;
988 this.FontPanel2.lblListBackcolor.BackColor = ColorDialog1.Color;
990 case "btnDetailBack":
991 this.FontPanel.lblDetailBackcolor.BackColor = ColorDialog1.Color;
993 case "btnDetailLink":
994 this.FontPanel.lblDetailLink.ForeColor = ColorDialog1.Color;
999 public MyCommon.IconSizes IconSz { get; set; }
1000 public string Status { get; set; }
1001 public bool UnreadManage { get; set; }
1002 public bool PlaySound { get; set; }
1003 public bool OneWayLove { get; set; }
1004 public Font FontUnread { get; set; } /////未使用
1005 public Color ColorUnread { get; set; }
1006 public Font FontReaded { get; set; } /////リストフォントとして使用
1007 public Color ColorReaded { get; set; }
1008 public Color ColorFav { get; set; }
1009 public Color ColorOWL { get; set; }
1010 public Color ColorRetweet { get; set; }
1011 public Font FontDetail { get; set; }
1012 public Color ColorDetail { get; set; }
1013 public Color ColorDetailLink { get; set; }
1014 public Color ColorSelf { get; set; }
1015 public Color ColorAtSelf { get; set; }
1016 public Color ColorTarget { get; set; }
1017 public Color ColorAtTarget { get; set; }
1018 public Color ColorAtFromTarget { get; set; }
1019 public Color ColorAtTo { get; set; }
1020 public Color ColorInputBackcolor { get; set; }
1021 public Color ColorInputFont { get; set; }
1022 public Font FontInputFont { get; set; }
1023 public Color ColorListBackcolor { get; set; }
1024 public Color ColorDetailBackcolor { get; set; }
1025 public MyCommon.NameBalloonEnum NameBalloon { get; set; }
1026 public bool PostCtrlEnter { get; set; }
1027 public bool PostShiftEnter { get; set; }
1028 public int CountApi { get; set; }
1029 public int CountApiReply { get; set; }
1030 public int MoreCountApi { get; set; }
1031 public int FirstCountApi { get; set; }
1032 public int SearchCountApi { get; set; }
1033 public int FavoritesCountApi { get; set; }
1034 public int UserTimelineCountApi { get; set; }
1035 public int ListCountApi { get; set; }
1036 public bool UseRecommendStatus { get; set; }
1037 public string RecommendStatusText { get; set; }
1038 public bool DispUsername { get; set; }
1039 public bool CloseToExit { get; set; }
1040 public bool MinimizeToTray { get; set; }
1041 public MyCommon.DispTitleEnum DispLatestPost { get; set; }
1042 public string BrowserPath { get; set; }
1043 public bool TinyUrlResolve { get; set; }
1045 public bool SortOrderLock { get; set; }
1046 public ProxyType SelectedProxyType
1049 return _MyProxyType;
1052 _MyProxyType = value;
1056 /// タブを下部に表示するかどうかを取得または設定する
1058 public bool ViewTabBottom { get; set; }
1060 public string ProxyAddress { get; set; }
1061 public int ProxyPort { get; set; }
1062 public string ProxyUser { get; set; }
1063 public string ProxyPassword { get; set; }
1064 public bool RestrictFavCheck { get; set; }
1065 public bool AlwaysTop { get; set; }
1066 public bool UrlConvertAuto { get; set; }
1067 public bool ShortenTco { get; set; }
1068 public bool Nicoms { get; set; }
1069 public MyCommon.UrlConverter AutoShortUrlFirst { get; set; }
1070 public bool UseUnreadStyle { get; set; }
1071 public string DateTimeFormat { get; set; }
1072 public int DefaultTimeOut { get; set; }
1073 public bool RetweetNoConfirm { get; set; }
1074 public bool TabIconDisp { get; set; }
1075 public MyCommon.REPLY_ICONSTATE ReplyIconState { get; set; }
1076 public bool ReadOwnPost { get; set; }
1077 public bool IsMonospace { get; set; }
1078 public bool ReadOldPosts { get; set; }
1079 public string BitlyUser { get; set; }
1080 public string BitlyPwd { get; set; }
1081 public bool ShowGrid { get; set; }
1082 public bool UseAtIdSupplement { get; set; }
1083 public bool UseHashSupplement { get; set; }
1084 public bool PreviewEnable { get; set; }
1085 public bool StatusAreaAtBottom { get; set; }
1086 public bool UseAdditionalCount { get; set; }
1087 public bool OpenUserTimeline { get; set; }
1088 public string TwitterApiUrl { get; set; }
1089 public string Language { get; set; }
1091 public bool LimitBalloon { get; set; }
1092 public bool EventNotifyEnabled { get; set; }
1094 public MyCommon.EVENTTYPE EventNotifyFlag
1098 return _MyEventNotifyFlag;
1102 _MyEventNotifyFlag = value;
1106 public MyCommon.EVENTTYPE IsMyEventNotifyFlag
1110 return _isMyEventNotifyFlag;
1114 _isMyEventNotifyFlag = value;
1118 public bool ForceEventNotify { get; set; }
1119 public bool FavEventUnread { get; set; }
1121 public string TranslateLanguage
1125 return _MyTranslateLanguage;
1129 _MyTranslateLanguage = value;
1130 this.CooperatePanel.ComboBoxTranslateLanguage.SelectedIndex = Bing.GetIndexFromLanguageEnum(value);
1134 public string EventSoundFile { get; set; }
1135 public int ListDoubleClickAction { get; set; }
1136 public string UserAppointUrl { get; set; }
1138 private bool StartAuth()
1142 if (this.ProxyPanel.RadioProxyNone.Checked)
1144 ptype = ProxyType.None;
1146 else if (this.ProxyPanel.RadioProxyIE.Checked)
1148 ptype = ProxyType.IE;
1152 ptype = ProxyType.Specified;
1154 string padr = this.ProxyPanel.TextProxyAddress.Text.Trim();
1155 int pport = int.Parse(this.ProxyPanel.TextProxyPort.Text.Trim());
1156 string pusr = this.ProxyPanel.TextProxyUser.Text.Trim();
1157 string ppw = this.ProxyPanel.TextProxyPassword.Text.Trim();
1160 Networking.DefaultTimeout = TimeSpan.FromSeconds(20);
1161 Networking.SetWebProxy(ptype, padr, pport, pusr, ppw);
1162 HttpTwitter.TwitterUrl = this.ConnectionPanel.TwitterAPIText.Text.Trim();
1163 tw.Initialize("", "", "", 0);
1164 //this.AuthStateLabel.Text = Properties.Resources.AuthorizeButton_Click4;
1165 //this.AuthUserLabel.Text = "";
1166 string pinPageUrl = "";
1167 string rslt = tw.StartAuthentication(ref pinPageUrl);
1168 if (string.IsNullOrEmpty(rslt))
1170 string pin = AuthDialog.DoAuth(this, pinPageUrl);
1171 if (!string.IsNullOrEmpty(pin))
1183 MessageBox.Show(Properties.Resources.AuthorizeButton_Click2 + Environment.NewLine + rslt, "Authenticate", MessageBoxButtons.OK);
1188 private bool PinAuth()
1190 string pin = this._pin; //PIN Code
1192 string rslt = tw.Authenticate(pin);
1193 if (string.IsNullOrEmpty(rslt))
1195 MessageBox.Show(Properties.Resources.AuthorizeButton_Click1, "Authenticate", MessageBoxButtons.OK);
1196 //this.AuthStateLabel.Text = Properties.Resources.AuthorizeButton_Click3;
1197 //this.AuthUserLabel.Text = tw.Username;
1199 UserAccount user = new UserAccount();
1200 user.Username = tw.Username;
1201 user.UserId = tw.UserId;
1202 user.Token = tw.AccessToken;
1203 user.TokenSecret = tw.AccessTokenSecret;
1205 foreach (object u in this.BasedPanel.AuthUserCombo.Items)
1207 if (((UserAccount)u).Username.ToLower() == tw.Username.ToLower())
1209 idx = this.BasedPanel.AuthUserCombo.Items.IndexOf(u);
1215 this.BasedPanel.AuthUserCombo.Items.RemoveAt(idx);
1216 this.BasedPanel.AuthUserCombo.Items.Insert(idx, user);
1217 this.BasedPanel.AuthUserCombo.SelectedIndex = idx;
1221 this.BasedPanel.AuthUserCombo.SelectedIndex = this.BasedPanel.AuthUserCombo.Items.Add(user);
1223 //if (TwitterApiInfo.AccessLevel = ApiAccessLevel.ReadWrite)
1225 // this.AuthStateLabel.Text += "(xAuth)";
1227 //else if (TwitterApiInfo.AccessLevel == ApiAccessLevel.ReadWriteAndDirectMessage)
1229 // this.AuthStateLabel.Text += "(OAuth)";
1235 MessageBox.Show(Properties.Resources.AuthorizeButton_Click2 + Environment.NewLine + rslt, "Authenticate", MessageBoxButtons.OK);
1236 //this.AuthStateLabel.Text = Properties.Resources.AuthorizeButton_Click4;
1237 //this.AuthUserLabel.Text = "";
1242 private void StartAuthButton_Click(object sender, EventArgs e)
1244 //this.Save.Enabled = false;
1249 //this.Save.Enabled = true;
1254 private void CheckPostAndGet_CheckedChanged(object sender, EventArgs e)
1256 this.GetPeriodPanel.LabelPostAndGet.Visible = this.GetPeriodPanel.CheckPostAndGet.Checked && !tw.UserStreamEnabled;
1259 private void Setting_Shown(object sender, EventArgs e)
1264 if (this.Disposing || this.IsDisposed) return;
1265 } while (!this.IsHandleCreated);
1266 this.TopMost = this.AlwaysTop;
1268 this.GetPeriodPanel.LabelPostAndGet.Visible = this.GetPeriodPanel.CheckPostAndGet.Checked && !tw.UserStreamEnabled;
1269 this.GetPeriodPanel.LabelUserStreamActive.Visible = tw.UserStreamEnabled;
1272 public static AppendSettingDialog Instance
1274 get { return _instance; }
1277 private bool BitlyValidation(string id, string apikey)
1279 if (string.IsNullOrEmpty(id) || string.IsNullOrEmpty(apikey))
1284 string req = "http://api.bit.ly/v3/validate";
1285 string content = "";
1286 Dictionary<string, string> param = new Dictionary<string, string>();
1288 param.Add("login", ApplicationSettings.BitlyLoginId);
1289 param.Add("apiKey", ApplicationSettings.BitlyApiKey);
1290 param.Add("x_login", id);
1291 param.Add("x_apiKey", apikey);
1292 param.Add("format", "txt");
1294 if (!(new HttpVarious()).PostData(req, param, out content))
1296 return true; // 通信エラーの場合はとりあえずチェックを通ったことにする
1298 else if (content.Trim() == "1")
1300 return true; // 検証成功
1302 else if (content.Trim() == "0")
1304 return false; // 検証失敗 APIキーとIDの組み合わせが違う
1308 return true; // 規定外応答:通信エラーの可能性があるためとりあえずチェックを通ったことにする
1312 private void Cancel_Click(object sender, EventArgs e)
1314 _ValidationError = false;
1317 public bool HotkeyEnabled;
1318 public Keys HotkeyKey;
1319 public int HotkeyValue;
1320 public Keys HotkeyMod;
1322 public bool BlinkNewMentions;
1324 //private void CheckEventNotify_CheckedChanged(object sender, EventArgs e)
1325 // Handles CheckEventNotify.CheckedChanged, CheckFavoritesEvent.CheckStateChanged,
1326 // CheckUnfavoritesEvent.CheckStateChanged, CheckFollowEvent.CheckStateChanged,
1327 // CheckListMemberAddedEvent.CheckStateChanged, CheckListMemberRemovedEvent.CheckStateChanged,
1328 // CheckListCreatedEvent.CheckStateChanged, CheckUserUpdateEvent.CheckStateChanged
1330 // EventNotifyEnabled = CheckEventNotify.Checked;
1331 // GetEventNotifyFlag(EventNotifyFlag, IsMyEventNotifyFlag);
1332 // ApplyEventNotifyFlag(EventNotifyEnabled, EventNotifyFlag, IsMyEventNotifyFlag);
1335 private class EventCheckboxTblElement
1337 public CheckBox CheckBox;
1338 public MyCommon.EVENTTYPE Type;
1341 private EventCheckboxTblElement[] GetEventCheckboxTable()
1343 EventCheckboxTblElement[] _eventCheckboxTable = new EventCheckboxTblElement[8];
1345 _eventCheckboxTable[0] = new EventCheckboxTblElement();
1346 _eventCheckboxTable[0].CheckBox = this.NotifyPanel.CheckFavoritesEvent;
1347 _eventCheckboxTable[0].Type = MyCommon.EVENTTYPE.Favorite;
1349 _eventCheckboxTable[1] = new EventCheckboxTblElement();
1350 _eventCheckboxTable[1].CheckBox = this.NotifyPanel.CheckUnfavoritesEvent;
1351 _eventCheckboxTable[1].Type = MyCommon.EVENTTYPE.Unfavorite;
1353 _eventCheckboxTable[2] = new EventCheckboxTblElement();
1354 _eventCheckboxTable[2].CheckBox = this.NotifyPanel.CheckFollowEvent;
1355 _eventCheckboxTable[2].Type = MyCommon.EVENTTYPE.Follow;
1357 _eventCheckboxTable[3] = new EventCheckboxTblElement();
1358 _eventCheckboxTable[3].CheckBox = this.NotifyPanel.CheckListMemberAddedEvent;
1359 _eventCheckboxTable[3].Type = MyCommon.EVENTTYPE.ListMemberAdded;
1361 _eventCheckboxTable[4] = new EventCheckboxTblElement();
1362 _eventCheckboxTable[4].CheckBox = this.NotifyPanel.CheckListMemberRemovedEvent;
1363 _eventCheckboxTable[4].Type = MyCommon.EVENTTYPE.ListMemberRemoved;
1365 _eventCheckboxTable[5] = new EventCheckboxTblElement();
1366 _eventCheckboxTable[5].CheckBox = this.NotifyPanel.CheckBlockEvent;
1367 _eventCheckboxTable[5].Type = MyCommon.EVENTTYPE.Block;
1369 _eventCheckboxTable[6] = new EventCheckboxTblElement();
1370 _eventCheckboxTable[6].CheckBox = this.NotifyPanel.CheckUserUpdateEvent;
1371 _eventCheckboxTable[6].Type = MyCommon.EVENTTYPE.UserUpdate;
1373 _eventCheckboxTable[7] = new EventCheckboxTblElement();
1374 _eventCheckboxTable[7].CheckBox = this.NotifyPanel.CheckListCreatedEvent;
1375 _eventCheckboxTable[7].Type = MyCommon.EVENTTYPE.ListCreated;
1377 return _eventCheckboxTable;
1380 private void GetEventNotifyFlag(ref MyCommon.EVENTTYPE eventnotifyflag, ref MyCommon.EVENTTYPE isMyeventnotifyflag)
1382 MyCommon.EVENTTYPE evt = MyCommon.EVENTTYPE.None;
1383 MyCommon.EVENTTYPE myevt = MyCommon.EVENTTYPE.None;
1385 foreach (EventCheckboxTblElement tbl in GetEventCheckboxTable())
1387 switch (tbl.CheckBox.CheckState)
1389 case CheckState.Checked:
1390 evt = evt | tbl.Type;
1391 myevt = myevt | tbl.Type;
1393 case CheckState.Indeterminate:
1394 evt = evt | tbl.Type;
1396 case CheckState.Unchecked:
1400 eventnotifyflag = evt;
1401 isMyeventnotifyflag = myevt;
1404 private void ApplyEventNotifyFlag(bool rootEnabled, MyCommon.EVENTTYPE eventnotifyflag, MyCommon.EVENTTYPE isMyeventnotifyflag)
1406 MyCommon.EVENTTYPE evt = eventnotifyflag;
1407 MyCommon.EVENTTYPE myevt = isMyeventnotifyflag;
1409 this.NotifyPanel.CheckEventNotify.Checked = rootEnabled;
1411 foreach (EventCheckboxTblElement tbl in GetEventCheckboxTable())
1413 if ((evt & tbl.Type) != 0)
1415 if ((myevt & tbl.Type) != 0)
1417 tbl.CheckBox.CheckState = CheckState.Checked;
1421 tbl.CheckBox.CheckState = CheckState.Indeterminate;
1426 tbl.CheckBox.CheckState = CheckState.Unchecked;
1428 tbl.CheckBox.Enabled = rootEnabled;
1433 private void CheckEventNotify_CheckedChanged(object sender, EventArgs e)
1435 foreach (EventCheckboxTblElement tbl in GetEventCheckboxTable())
1437 tbl.CheckBox.Enabled = this.NotifyPanel.CheckEventNotify.Checked;
1441 //private void CheckForceEventNotify_CheckedChanged(object sender, EventArgs e)
1443 // _MyForceEventNotify = CheckEventNotify.Checked;
1446 //private void CheckFavEventUnread_CheckedChanged(object sender, EventArgs e)
1448 // _MyFavEventUnread = CheckFavEventUnread.Checked;
1451 //private void ComboBoxTranslateLanguage_SelectedIndexChanged(object sender, EventArgs e)
1453 // _MyTranslateLanguage = (new Google()).GetLanguageEnumFromIndex(ComboBoxTranslateLanguage.SelectedIndex);
1456 private void SoundFileListup()
1458 if (EventSoundFile == null) EventSoundFile = "";
1459 this.NotifyPanel.ComboBoxEventNotifySound.Items.Clear();
1460 this.NotifyPanel.ComboBoxEventNotifySound.Items.Add("");
1461 DirectoryInfo oDir = new DirectoryInfo(Application.StartupPath + Path.DirectorySeparatorChar);
1462 if (Directory.Exists(Path.Combine(Application.StartupPath, "Sounds")))
1464 oDir = oDir.GetDirectories("Sounds")[0];
1466 foreach (FileInfo oFile in oDir.GetFiles("*.wav"))
1468 this.NotifyPanel.ComboBoxEventNotifySound.Items.Add(oFile.Name);
1470 int idx = this.NotifyPanel.ComboBoxEventNotifySound.Items.IndexOf(EventSoundFile);
1471 if (idx == -1) idx = 0;
1472 this.NotifyPanel.ComboBoxEventNotifySound.SelectedIndex = idx;
1475 //private void ComboBoxEventNotifySound_VisibleChanged(object sender, EventArgs e)
1477 // SoundFileListup();
1480 //private void ComboBoxEventNotifySound_SelectedIndexChanged(object sender, EventArgs e)
1482 // if (_soundfileListup) return;
1484 // _MyEventSoundFile = (string)ComboBoxEventNotifySound.SelectedItem;
1487 private void OpenUrl(string url)
1489 string myPath = url;
1490 string path = this.ActionPanel.BrowserPathText.Text;
1493 if (!string.IsNullOrEmpty(BrowserPath))
1495 if (path.StartsWith("\"") && path.Length > 2 && path.IndexOf("\"", 2) > -1)
1497 int sep = path.IndexOf("\"", 2);
1498 string browserPath = path.Substring(1, sep - 1);
1500 if (sep < path.Length - 1)
1502 arg = path.Substring(sep + 1);
1504 myPath = arg + " " + myPath;
1505 System.Diagnostics.Process.Start(browserPath, myPath);
1509 System.Diagnostics.Process.Start(path, myPath);
1514 System.Diagnostics.Process.Start(myPath);
1519 // MessageBox.Show("ブラウザの起動に失敗、またはタイムアウトしました。" + ex.ToString());
1523 private void CreateAccountButton_Click(object sender, EventArgs e)
1525 this.OpenUrl("https://twitter.com/signup");
1528 public AppendSettingDialog()
1530 InitializeComponent();
1532 this.BasedPanel.StartAuthButton.Click += this.StartAuthButton_Click;
1533 this.BasedPanel.CreateAccountButton.Click += this.CreateAccountButton_Click;
1534 this.NotifyPanel.CheckEventNotify.CheckedChanged += this.CheckEventNotify_CheckedChanged;
1535 this.GetPeriodPanel.CheckPostAndGet.CheckedChanged += this.CheckPostAndGet_CheckedChanged;
1536 this.ActionPanel.UReadMng.CheckedChanged += this.UReadMng_CheckedChanged;
1537 this.FontPanel.btnUnread.Click += this.btnFontAndColor_Click;
1538 this.FontPanel.btnDetail.Click += this.btnFontAndColor_Click;
1539 this.FontPanel.btnListFont.Click += this.btnFontAndColor_Click;
1540 this.FontPanel.btnFav.Click += this.btnColor_Click;
1541 this.FontPanel.btnOWL.Click += this.btnColor_Click;
1542 this.FontPanel.btnRetweet.Click += this.btnColor_Click;
1543 this.FontPanel.btnDetailBack.Click += this.btnColor_Click;
1544 this.FontPanel.btnDetailLink.Click += this.btnColor_Click;
1545 this.FontPanel2.btnInputFont.Click += this.btnFontAndColor_Click;
1546 this.FontPanel2.btnSelf.Click += this.btnColor_Click;
1547 this.FontPanel2.btnAtSelf.Click += this.btnColor_Click;
1548 this.FontPanel2.btnTarget.Click += this.btnColor_Click;
1549 this.FontPanel2.btnAtTarget.Click += this.btnColor_Click;
1550 this.FontPanel2.btnAtFromTarget.Click += this.btnColor_Click;
1551 this.FontPanel2.btnInputBackcolor.Click += this.btnColor_Click;
1552 this.FontPanel2.btnAtTo.Click += this.btnColor_Click;
1553 this.FontPanel2.btnListBack.Click += this.btnColor_Click;
1555 this.Icon = Properties.Resources.MIcon;
1558 private void GetPeriodPanel_IntervalChanged(object sender, IntervalChangedEventArgs e)
1560 if (this.IntervalChanged != null)
1561 this.IntervalChanged(sender, e);
1565 public class IntervalChangedEventArgs : EventArgs
1567 public bool UserStream;
1568 public bool Timeline;
1570 public bool DirectMessage;
1571 public bool PublicSearch;
1573 public bool UserTimeline;