OSDN Git Service

APIレートリミット表示ダイアログに関わるコードのAPI v1.1\b仮対応
[opentween/open-tween.git] / OpenTween / AppendSettingDialog.cs
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.
9 // 
10 // This file is part of OpenTween.
11 // 
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)
15 // any later version.
16 // 
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
20 // for more details. 
21 // 
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.
26
27 using System;
28 using System.Collections.Generic;
29 using System.ComponentModel;
30 using System.Data;
31 using System.Drawing;
32 using System.Linq;
33 using System.Text;
34 using System.Windows.Forms;
35 using System.Threading;
36 using System.IO;
37 using System.Resources;
38 using OpenTween.Thumbnail;
39 using System.Threading.Tasks;
40
41 namespace OpenTween
42 {
43     public partial class AppendSettingDialog : Form
44     {
45         private static AppendSettingDialog _instance = new AppendSettingDialog();
46         private Twitter tw;
47         private HttpConnection.ProxyType _MyProxyType;
48
49         private bool _ValidationError = false;
50         private MyCommon.EVENTTYPE _MyEventNotifyFlag;
51         private MyCommon.EVENTTYPE _isMyEventNotifyFlag;
52         private string _MyTranslateLanguage;
53
54         public bool HideDuplicatedRetweets;
55
56         public bool IsPreviewFoursquare;
57         public MapProvider MapThumbnailProvider;
58         public int MapThumbnailHeight;
59         public int MapThumbnailWidth;
60         public int MapThumbnailZoom;
61         public bool IsListStatusesIncludeRts;
62         public List<UserAccount> UserAccounts;
63         private long InitialUserId;
64         public bool TabMouseLock;
65         public bool IsRemoveSameEvent;
66         public bool IsNotifyUseGrowl;
67
68         public TwitterDataModel.Configuration TwitterConfiguration = new TwitterDataModel.Configuration();
69
70         private string _pin;
71
72         public class IntervalChangedEventArgs : EventArgs
73         {
74             public bool UserStream;
75             public bool Timeline;
76             public bool Reply;
77             public bool DirectMessage;
78             public bool PublicSearch;
79             public bool Lists;
80             public bool UserTimeline;
81         }
82
83         public delegate void IntervalChangedEventHandler(object sender, IntervalChangedEventArgs e);
84         public event IntervalChangedEventHandler IntervalChanged;
85
86         private void TreeViewSetting_BeforeSelect(object sender, TreeViewCancelEventArgs e)
87         {
88             if (this.TreeViewSetting.SelectedNode == null) return;
89             Panel pnl = (Panel)this.TreeViewSetting.SelectedNode.Tag;
90             if (pnl == null) return;
91             pnl.Enabled = false;
92             pnl.Visible = false;
93         }
94
95         private void TreeViewSetting_AfterSelect(object sender, TreeViewEventArgs e)
96         {
97             if (e.Node == null) return;
98             Panel pnl = (Panel)e.Node.Tag;
99             if (pnl == null) return;
100             pnl.Enabled = true;
101             pnl.Visible = true;
102
103             if (pnl.Name == "PreviewPanel")
104             {
105                 if (GrowlHelper.IsDllExists)
106                 {
107                     IsNotifyUseGrowlCheckBox.Enabled = true;
108                 }
109                 else
110                 {
111                     IsNotifyUseGrowlCheckBox.Enabled = false;
112                 }
113             }
114         }
115
116         private void Save_Click(object sender, EventArgs e)
117         {
118             if (MyCommon.IsNetworkAvailable() &&
119                 (ComboBoxAutoShortUrlFirst.SelectedIndex == (int)MyCommon.UrlConverter.Bitly || ComboBoxAutoShortUrlFirst.SelectedIndex == (int)MyCommon.UrlConverter.Jmp))
120             {
121                 // bit.ly 短縮機能実装のプライバシー問題の暫定対応
122                 // bit.ly 使用時はログインIDとAPIキーの指定を必須とする
123                 // 参照: http://sourceforge.jp/projects/opentween/lists/archive/dev/2012-January/000020.html
124                 if (string.IsNullOrEmpty(TextBitlyId.Text) || string.IsNullOrEmpty(TextBitlyPw.Text))
125                 {
126                     MessageBox.Show("bit.ly のログイン名とAPIキーの指定は必須項目です。", Application.ProductName);
127                     _ValidationError = true;
128                     TreeViewSetting.SelectedNode = TreeViewSetting.Nodes["ConnectionNode"].Nodes["ShortUrlNode"]; // 動作タブを選択
129                     TreeViewSetting.Select();
130                     TextBitlyId.Focus();
131                     return;
132                 }
133
134                 if (!BitlyValidation(TextBitlyId.Text, TextBitlyPw.Text))
135                 {
136                     MessageBox.Show(Properties.Resources.SettingSave_ClickText1);
137                     _ValidationError = true;
138                     TreeViewSetting.SelectedNode = TreeViewSetting.Nodes["ConnectionNode"].Nodes["ShortUrlNode"]; // 動作タブを選択
139                     TreeViewSetting.Select();
140                     TextBitlyId.Focus();
141                     return;
142                 }
143                 else
144                 {
145                     _ValidationError = false;
146                 }
147             }
148             else
149             {
150                 _ValidationError = false;
151             }
152
153             this.UserAccounts.Clear();
154             foreach (object u in this.AuthUserCombo.Items)
155             {
156                 this.UserAccounts.Add((UserAccount)u);
157             }
158             if (this.AuthUserCombo.SelectedIndex > -1)
159             {
160                 foreach (UserAccount u in this.UserAccounts)
161                 {
162                     if (u.Username.ToLower() == ((UserAccount)this.AuthUserCombo.SelectedItem).Username.ToLower())
163                     {
164                         tw.Initialize(u.Token, u.TokenSecret, u.Username, u.UserId);
165                         if (u.UserId == 0)
166                         {
167                             tw.VerifyCredentials();
168                             u.UserId = tw.UserId;
169                         }
170                         break;
171                     }
172                 }
173             }
174             else
175             {
176                 tw.ClearAuthInfo();
177                 tw.Initialize("", "", "", 0);
178             }
179
180 #if UA
181             //フォロー
182             if (this.FollowCheckBox.Checked)
183             {
184                 //現在の設定内容で通信
185                 HttpConnection.ProxyType ptype;
186                 if (RadioProxyNone.Checked)
187                 {
188                     ptype = HttpConnection.ProxyType.None;
189                 }
190                 else if (RadioProxyIE.Checked)
191                 {
192                     ptype = HttpConnection.ProxyType.IE;
193                 }
194                 else
195                 {
196                     ptype = HttpConnection.ProxyType.Specified;
197                 }
198                 string padr = TextProxyAddress.Text.Trim();
199                 int pport = int.Parse(TextProxyPort.Text.Trim());
200                 string pusr = TextProxyUser.Text.Trim();
201                 string ppw = TextProxyPassword.Text.Trim();
202                 HttpConnection.InitializeConnection(20, ptype, padr, pport, pusr, ppw);
203
204                 string ret = tw.PostFollowCommand(ApplicationSettings.FeedbackTwitterName);
205             }
206 #endif
207             IntervalChangedEventArgs arg = new IntervalChangedEventArgs();
208             bool isIntervalChanged = false;
209
210             try
211             {
212                 UserstreamStartup = this.StartupUserstreamCheck.Checked;
213
214                 if (UserstreamPeriodInt != int.Parse(UserstreamPeriod.Text))
215                 {
216                     UserstreamPeriodInt = int.Parse(UserstreamPeriod.Text);
217                     arg.UserStream = true;
218                     isIntervalChanged = true;
219                 }
220                 if (TimelinePeriodInt != int.Parse(TimelinePeriod.Text))
221                 {
222                     TimelinePeriodInt = int.Parse(TimelinePeriod.Text);
223                     arg.Timeline = true;
224                     isIntervalChanged = true;
225                 }
226                 if (DMPeriodInt != int.Parse(DMPeriod.Text))
227                 {
228                     DMPeriodInt = int.Parse(DMPeriod.Text);
229                     arg.DirectMessage = true;
230                     isIntervalChanged = true;
231                 }
232                 if (PubSearchPeriodInt != int.Parse(PubSearchPeriod.Text))
233                 {
234                     PubSearchPeriodInt = int.Parse(PubSearchPeriod.Text);
235                     arg.PublicSearch = true;
236                     isIntervalChanged = true;
237                 }
238
239                 if (ListsPeriodInt != int.Parse(ListsPeriod.Text))
240                 {
241                     ListsPeriodInt = int.Parse(ListsPeriod.Text);
242                     arg.Lists = true;
243                     isIntervalChanged = true;
244                 }
245                 if (ReplyPeriodInt != int.Parse(ReplyPeriod.Text))
246                 {
247                     ReplyPeriodInt = int.Parse(ReplyPeriod.Text);
248                     arg.Reply = true;
249                     isIntervalChanged = true;
250                 }
251                 if (UserTimelinePeriodInt != int.Parse(UserTimelinePeriod.Text))
252                 {
253                     UserTimelinePeriodInt = int.Parse(UserTimelinePeriod.Text);
254                     arg.UserTimeline = true;
255                     isIntervalChanged = true;
256                 }
257
258                 if (isIntervalChanged && IntervalChanged != null)
259                 {
260                     IntervalChanged(this, arg);
261                 }
262
263                 Readed = StartupReaded.Checked;
264                 switch (IconSize.SelectedIndex)
265                 {
266                     case 0:
267                         IconSz = MyCommon.IconSizes.IconNone;
268                         break;
269                     case 1:
270                         IconSz = MyCommon.IconSizes.Icon16;
271                         break;
272                     case 2:
273                         IconSz = MyCommon.IconSizes.Icon24;
274                         break;
275                     case 3:
276                         IconSz = MyCommon.IconSizes.Icon48;
277                         break;
278                     case 4:
279                         IconSz = MyCommon.IconSizes.Icon48_2;
280                         break;
281                 }
282                 Status = StatusText.Text;
283                 PlaySound = PlaySnd.Checked;
284                 UnreadManage = UReadMng.Checked;
285                 OneWayLove = OneWayLv.Checked;
286
287                 FontUnread = lblUnread.Font;     //未使用
288                 ColorUnread = lblUnread.ForeColor;
289                 FontReaded = lblListFont.Font;     //リストフォントとして使用
290                 ColorReaded = lblListFont.ForeColor;
291                 ColorFav = lblFav.ForeColor;
292                 ColorOWL = lblOWL.ForeColor;
293                 ColorRetweet = lblRetweet.ForeColor;
294                 FontDetail = lblDetail.Font;
295                 ColorSelf = lblSelf.BackColor;
296                 ColorAtSelf = lblAtSelf.BackColor;
297                 ColorTarget = lblTarget.BackColor;
298                 ColorAtTarget = lblAtTarget.BackColor;
299                 ColorAtFromTarget = lblAtFromTarget.BackColor;
300                 ColorAtTo = lblAtTo.BackColor;
301                 ColorInputBackcolor = lblInputBackcolor.BackColor;
302                 ColorInputFont = lblInputFont.ForeColor;
303                 ColorListBackcolor = lblListBackcolor.BackColor;
304                 ColorDetailBackcolor = lblDetailBackcolor.BackColor;
305                 ColorDetail = lblDetail.ForeColor;
306                 ColorDetailLink = lblDetailLink.ForeColor;
307                 FontInputFont = lblInputFont.Font;
308                 switch (cmbNameBalloon.SelectedIndex)
309                 {
310                     case 0:
311                         NameBalloon = MyCommon.NameBalloonEnum.None;
312                         break;
313                     case 1:
314                         NameBalloon = MyCommon.NameBalloonEnum.UserID;
315                         break;
316                     case 2:
317                         NameBalloon = MyCommon.NameBalloonEnum.NickName;
318                         break;
319                 }
320
321                 switch (ComboBoxPostKeySelect.SelectedIndex)
322                 {
323                     case 2:
324                         PostShiftEnter = true;
325                         PostCtrlEnter = false;
326                         break;
327                     case 1:
328                         PostCtrlEnter = true;
329                         PostShiftEnter = false;
330                         break;
331                     case 0:
332                         PostCtrlEnter = false;
333                         PostShiftEnter = false;
334                         break;
335                 }
336                 CountApi = int.Parse(TextCountApi.Text);
337                 CountApiReply = int.Parse(TextCountApiReply.Text);
338                 BrowserPath = BrowserPathText.Text.Trim();
339                 PostAndGet = CheckPostAndGet.Checked;
340                 UseRecommendStatus = CheckUseRecommendStatus.Checked;
341                 DispUsername = CheckDispUsername.Checked;
342                 CloseToExit = CheckCloseToExit.Checked;
343                 MinimizeToTray = CheckMinimizeToTray.Checked;
344                 switch (ComboDispTitle.SelectedIndex)
345                 {
346                     case 0:  //None
347                         DispLatestPost = MyCommon.DispTitleEnum.None;
348                         break;
349                     case 1:  //Ver
350                         DispLatestPost = MyCommon.DispTitleEnum.Ver;
351                         break;
352                     case 2:  //Post
353                         DispLatestPost = MyCommon.DispTitleEnum.Post;
354                         break;
355                     case 3:  //RepCount
356                         DispLatestPost = MyCommon.DispTitleEnum.UnreadRepCount;
357                         break;
358                     case 4:  //AllCount
359                         DispLatestPost = MyCommon.DispTitleEnum.UnreadAllCount;
360                         break;
361                     case 5:  //Rep+All
362                         DispLatestPost = MyCommon.DispTitleEnum.UnreadAllRepCount;
363                         break;
364                     case 6:  //Unread/All
365                         DispLatestPost = MyCommon.DispTitleEnum.UnreadCountAllCount;
366                         break;
367                     case 7: //Count of Status/Follow/Follower
368                         DispLatestPost = MyCommon.DispTitleEnum.OwnStatus;
369                         break;
370                 }
371                 SortOrderLock = CheckSortOrderLock.Checked;
372                 ViewTabBottom = CheckViewTabBottom.Checked;
373                 TinyUrlResolve = CheckTinyURL.Checked;
374                 ShortUrlForceResolve = CheckForceResolve.Checked;
375                 ShortUrl.IsResolve = TinyUrlResolve;
376                 ShortUrl.IsForceResolve = ShortUrlForceResolve;
377                 if (RadioProxyNone.Checked)
378                 {
379                     _MyProxyType = HttpConnection.ProxyType.None;
380                 }
381                 else if (RadioProxyIE.Checked)
382                 {
383                     _MyProxyType = HttpConnection.ProxyType.IE;
384                 }
385                 else
386                 {
387                     _MyProxyType = HttpConnection.ProxyType.Specified;
388                 }
389                 ProxyAddress = TextProxyAddress.Text.Trim();
390                 ProxyPort = int.Parse(TextProxyPort.Text.Trim());
391                 ProxyUser = TextProxyUser.Text.Trim();
392                 ProxyPassword = TextProxyPassword.Text.Trim();
393                 PeriodAdjust = CheckPeriodAdjust.Checked;
394                 StartupVersion = CheckStartupVersion.Checked;
395                 StartupFollowers = CheckStartupFollowers.Checked;
396                 RestrictFavCheck = CheckFavRestrict.Checked;
397                 AlwaysTop = CheckAlwaysTop.Checked;
398                 UrlConvertAuto = CheckAutoConvertUrl.Checked;
399                 ShortenTco = ShortenTcoCheck.Checked;
400                 OutputzEnabled = CheckOutputz.Checked;
401                 OutputzKey = TextBoxOutputzKey.Text.Trim();
402
403                 switch (ComboBoxOutputzUrlmode.SelectedIndex)
404                 {
405                     case 0:
406                         OutputzUrlmode = MyCommon.OutputzUrlmode.twittercom;
407                         break;
408                     case 1:
409                         OutputzUrlmode = MyCommon.OutputzUrlmode.twittercomWithUsername;
410                         break;
411                 }
412
413                 Nicoms = CheckNicoms.Checked;
414                 UseUnreadStyle = chkUnreadStyle.Checked;
415                 DateTimeFormat = CmbDateTimeFormat.Text;
416                 DefaultTimeOut = int.Parse(ConnectionTimeOut.Text);
417                 RetweetNoConfirm = CheckRetweetNoConfirm.Checked;
418                 LimitBalloon = CheckBalloonLimit.Checked;
419                 EventNotifyEnabled = CheckEventNotify.Checked;
420                 GetEventNotifyFlag(ref _MyEventNotifyFlag, ref _isMyEventNotifyFlag);
421                 ForceEventNotify = CheckForceEventNotify.Checked;
422                 FavEventUnread = CheckFavEventUnread.Checked;
423                 TranslateLanguage = (new Bing()).GetLanguageEnumFromIndex(ComboBoxTranslateLanguage.SelectedIndex);
424                 EventSoundFile = (string)ComboBoxEventNotifySound.SelectedItem;
425                 AutoShortUrlFirst = (MyCommon.UrlConverter)ComboBoxAutoShortUrlFirst.SelectedIndex;
426                 TabIconDisp = chkTabIconDisp.Checked;
427                 ReadOwnPost = chkReadOwnPost.Checked;
428                 GetFav = chkGetFav.Checked;
429                 IsMonospace = CheckMonospace.Checked;
430                 ReadOldPosts = CheckReadOldPosts.Checked;
431                 UseSsl = CheckUseSsl.Checked;
432                 BitlyUser = TextBitlyId.Text;
433                 BitlyPwd = TextBitlyPw.Text;
434                 ShowGrid = CheckShowGrid.Checked;
435                 UseAtIdSupplement = CheckAtIdSupple.Checked;
436                 UseHashSupplement = CheckHashSupple.Checked;
437                 PreviewEnable = CheckPreviewEnable.Checked;
438                 TwitterApiUrl = TwitterAPIText.Text.Trim();
439                 TwitterSearchApiUrl = TwitterSearchAPIText.Text.Trim();
440                 switch (ReplyIconStateCombo.SelectedIndex)
441                 {
442                     case 0:
443                         ReplyIconState = MyCommon.REPLY_ICONSTATE.None;
444                         break;
445                     case 1:
446                         ReplyIconState = MyCommon.REPLY_ICONSTATE.StaticIcon;
447                         break;
448                     case 2:
449                         ReplyIconState = MyCommon.REPLY_ICONSTATE.BlinkIcon;
450                         break;
451                 }
452                 switch (LanguageCombo.SelectedIndex)
453                 {
454                     case 0:
455                         Language = "OS";
456                         break;
457                     case 1:
458                         Language = "ja";
459                         break;
460                     case 2:
461                         Language = "en";
462                         break;
463                     case 3:
464                         Language = "zh-CN";
465                         break;
466                     default:
467                         Language = "en";
468                         break;
469                 }
470                 HotkeyEnabled = this.HotkeyCheck.Checked;
471                 HotkeyMod = Keys.None;
472                 if (this.HotkeyAlt.Checked) HotkeyMod = HotkeyMod | Keys.Alt;
473                 if (this.HotkeyShift.Checked) HotkeyMod = HotkeyMod | Keys.Shift;
474                 if (this.HotkeyCtrl.Checked) HotkeyMod = HotkeyMod | Keys.Control;
475                 if (this.HotkeyWin.Checked) HotkeyMod = HotkeyMod | Keys.LWin;
476                 int.TryParse(HotkeyCode.Text, out HotkeyValue);
477                 HotkeyKey = (Keys)HotkeyText.Tag;
478                 BlinkNewMentions = ChkNewMentionsBlink.Checked;
479                 UseAdditionalCount = UseChangeGetCount.Checked;
480                 MoreCountApi = int.Parse(GetMoreTextCountApi.Text);
481                 FirstCountApi = int.Parse(FirstTextCountApi.Text);
482                 SearchCountApi = int.Parse(SearchTextCountApi.Text);
483                 FavoritesCountApi = int.Parse(FavoritesTextCountApi.Text);
484                 UserTimelineCountApi = int.Parse(UserTimelineTextCountApi.Text);
485                 ListCountApi = int.Parse(ListTextCountApi.Text);
486                 OpenUserTimeline = CheckOpenUserTimeline.Checked;
487                 ListDoubleClickAction = ListDoubleClickActionComboBox.SelectedIndex;
488                 UserAppointUrl = UserAppointUrlText.Text;
489                 this.HideDuplicatedRetweets = this.HideDuplicatedRetweetsCheck.Checked;
490                 this.IsPreviewFoursquare = this.IsPreviewFoursquareCheckBox.Checked;
491                 this.MapThumbnailProvider = (MapProvider)this.MapThumbnailProviderComboBox.SelectedIndex;
492                 this.MapThumbnailHeight = int.Parse(this.MapThumbnailHeightTextBox.Text);
493                 this.MapThumbnailWidth = int.Parse(this.MapThumbnailWidthTextBox.Text);
494                 this.MapThumbnailZoom = int.Parse(this.MapThumbnailZoomTextBox.Text);
495                 this.IsListStatusesIncludeRts = this.IsListsIncludeRtsCheckBox.Checked;
496                 this.TabMouseLock = this.TabMouseLockCheck.Checked;
497                 this.IsRemoveSameEvent = this.IsRemoveSameFavEventCheckBox.Checked;
498                 this.IsNotifyUseGrowl = this.IsNotifyUseGrowlCheckBox.Checked;
499             }
500             catch(Exception)
501             {
502                 MessageBox.Show(Properties.Resources.Save_ClickText3);
503                 this.DialogResult = DialogResult.Cancel;
504                 return;
505             }
506         }
507
508         private void Setting_FormClosing(object sender, FormClosingEventArgs e)
509         {
510             if (MyCommon._endingFlag) return;
511
512             if (this.DialogResult == DialogResult.Cancel)
513             {
514                 //キャンセル時は画面表示時のアカウントに戻す
515                 //キャンセル時でも認証済みアカウント情報は保存する
516                 this.UserAccounts.Clear();
517                 foreach (object u in this.AuthUserCombo.Items)
518                 {
519                     this.UserAccounts.Add((UserAccount)u);
520                 }
521                 //アクティブユーザーを起動時のアカウントに戻す(起動時アカウントなければ何もしない)
522                 bool userSet = false;
523                 if (this.InitialUserId > 0)
524                 {
525                     foreach (UserAccount u in this.UserAccounts)
526                     {
527                         if (u.UserId == this.InitialUserId)
528                         {
529                             tw.Initialize(u.Token, u.TokenSecret, u.Username, u.UserId);
530                             userSet = true;
531                             break;
532                         }
533                     }
534                 }
535                 //認証済みアカウントが削除されていた場合、もしくは起動時アカウントがなかった場合は、
536                 //アクティブユーザーなしとして初期化
537                 if (!userSet)
538                 {
539                     tw.ClearAuthInfo();
540                     tw.Initialize("", "", "", 0);
541                 }
542             }
543
544             if (tw != null && string.IsNullOrEmpty(tw.Username) && e.CloseReason == CloseReason.None)
545             {
546                 if (MessageBox.Show(Properties.Resources.Setting_FormClosing1, "Confirm", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.Cancel)
547                 {
548                     e.Cancel = true;
549                 }
550             }
551             if (_ValidationError)
552             {
553                 e.Cancel = true;
554             }
555             if (e.Cancel == false && TreeViewSetting.SelectedNode != null)
556             {
557                 Panel curPanel = (Panel)TreeViewSetting.SelectedNode.Tag;
558                 curPanel.Visible = false;
559                 curPanel.Enabled = false;
560             }
561         }
562
563         private void Setting_Load(object sender, EventArgs e)
564         {
565 #if UA
566             this.FollowCheckBox.Text = string.Format(this.FollowCheckBox.Text, ApplicationSettings.FeedbackTwitterName);
567             this.GroupBox2.Visible = true;
568 #else
569             this.GroupBox2.Visible = false;
570 #endif
571             tw = ((TweenMain)this.Owner).TwitterInstance;
572             string uname = tw.Username;
573             string pw = tw.Password;
574             string tk = tw.AccessToken;
575             string tks = tw.AccessTokenSecret;
576             //this.AuthStateLabel.Enabled = true;
577             //this.AuthUserLabel.Enabled = true;
578             this.AuthClearButton.Enabled = true;
579
580             //if (tw.Username == "")
581             //{
582             //    //this.AuthStateLabel.Text = Properties.Resources.AuthorizeButton_Click4
583             //    //this.AuthUserLabel.Text = ""
584             //    //this.Save.Enabled = false
585             //}
586             //else
587             //{
588             //    //this.AuthStateLabel.Text = Properties.Resources.AuthorizeButton_Click3;
589             //    //if (TwitterApiInfo.AccessLevel == ApiAccessLevel.ReadWrite)
590             //    //{
591             //    //    this.AuthStateLabel.Text += "(xAuth)";
592             //    //}
593             //    //else if (TwitterApiInfo.AccessLevel == ApiAccessLevel.ReadWriteAndDirectMessage)
594             //    //{
595             //    //    this.AuthStateLabel.Text += "(OAuth)";
596             //    //}
597             //    //this.AuthUserLabel.Text = tw.Username;
598             //}
599
600             this.AuthUserCombo.Items.Clear();
601             if (this.UserAccounts.Count > 0)
602             {
603                 this.AuthUserCombo.Items.AddRange(this.UserAccounts.ToArray());
604                 foreach (UserAccount u in this.UserAccounts)
605                 {
606                     if (u.UserId == tw.UserId)
607                     {
608                         this.AuthUserCombo.SelectedItem = u;
609                         this.InitialUserId = u.UserId;
610                         break;
611                     }
612                 }
613             }
614
615             this.StartupUserstreamCheck.Checked = UserstreamStartup;
616             UserstreamPeriod.Text = UserstreamPeriodInt.ToString();
617             TimelinePeriod.Text = TimelinePeriodInt.ToString();
618             ReplyPeriod.Text = ReplyPeriodInt.ToString();
619             DMPeriod.Text = DMPeriodInt.ToString();
620             PubSearchPeriod.Text = PubSearchPeriodInt.ToString();
621             ListsPeriod.Text = ListsPeriodInt.ToString();
622             UserTimelinePeriod.Text = UserTimelinePeriodInt.ToString();
623
624             StartupReaded.Checked = Readed;
625             switch (IconSz)
626             {
627                 case MyCommon.IconSizes.IconNone:
628                     IconSize.SelectedIndex = 0;
629                     break;
630                 case MyCommon.IconSizes.Icon16:
631                     IconSize.SelectedIndex = 1;
632                     break;
633                 case MyCommon.IconSizes.Icon24:
634                     IconSize.SelectedIndex = 2;
635                     break;
636                 case MyCommon.IconSizes.Icon48:
637                     IconSize.SelectedIndex = 3;
638                     break;
639                 case MyCommon.IconSizes.Icon48_2:
640                     IconSize.SelectedIndex = 4;
641                     break;
642             }
643             StatusText.Text = Status;
644             UReadMng.Checked = UnreadManage;
645             if (UnreadManage == false)
646             {
647                 StartupReaded.Enabled = false;
648             }
649             else
650             {
651                 StartupReaded.Enabled = true;
652             }
653             PlaySnd.Checked = PlaySound;
654             OneWayLv.Checked = OneWayLove;
655
656             lblListFont.Font = FontReaded;
657             lblUnread.Font = FontUnread;
658             lblUnread.ForeColor = ColorUnread;
659             lblListFont.ForeColor = ColorReaded;
660             lblFav.ForeColor = ColorFav;
661             lblOWL.ForeColor = ColorOWL;
662             lblRetweet.ForeColor = ColorRetweet;
663             lblDetail.Font = FontDetail;
664             lblSelf.BackColor = ColorSelf;
665             lblAtSelf.BackColor = ColorAtSelf;
666             lblTarget.BackColor = ColorTarget;
667             lblAtTarget.BackColor = ColorAtTarget;
668             lblAtFromTarget.BackColor = ColorAtFromTarget;
669             lblAtTo.BackColor = ColorAtTo;
670             lblInputBackcolor.BackColor = ColorInputBackcolor;
671             lblInputFont.ForeColor = ColorInputFont;
672             lblInputFont.Font = FontInputFont;
673             lblListBackcolor.BackColor = ColorListBackcolor;
674             lblDetailBackcolor.BackColor = ColorDetailBackcolor;
675             lblDetail.ForeColor = ColorDetail;
676             lblDetailLink.ForeColor = ColorDetailLink;
677
678             switch (NameBalloon)
679             {
680                 case MyCommon.NameBalloonEnum.None:
681                     cmbNameBalloon.SelectedIndex = 0;
682                     break;
683                 case MyCommon.NameBalloonEnum.UserID:
684                     cmbNameBalloon.SelectedIndex = 1;
685                     break;
686                 case MyCommon.NameBalloonEnum.NickName:
687                     cmbNameBalloon.SelectedIndex = 2;
688                     break;
689             }
690
691             if (PostCtrlEnter)
692             {
693                 ComboBoxPostKeySelect.SelectedIndex = 1;
694             }
695             else if (PostShiftEnter)
696             {
697                 ComboBoxPostKeySelect.SelectedIndex = 2;
698             }
699             else
700             {
701                 ComboBoxPostKeySelect.SelectedIndex = 0;
702             }
703
704             TextCountApi.Text = CountApi.ToString();
705             TextCountApiReply.Text = CountApiReply.ToString();
706             BrowserPathText.Text = BrowserPath;
707             CheckPostAndGet.Checked = PostAndGet;
708             CheckUseRecommendStatus.Checked = UseRecommendStatus;
709             CheckDispUsername.Checked = DispUsername;
710             CheckCloseToExit.Checked = CloseToExit;
711             CheckMinimizeToTray.Checked = MinimizeToTray;
712             switch (DispLatestPost)
713             {
714                 case MyCommon.DispTitleEnum.None:
715                     ComboDispTitle.SelectedIndex = 0;
716                     break;
717                 case MyCommon.DispTitleEnum.Ver:
718                     ComboDispTitle.SelectedIndex = 1;
719                     break;
720                 case MyCommon.DispTitleEnum.Post:
721                     ComboDispTitle.SelectedIndex = 2;
722                     break;
723                 case MyCommon.DispTitleEnum.UnreadRepCount:
724                     ComboDispTitle.SelectedIndex = 3;
725                     break;
726                 case MyCommon.DispTitleEnum.UnreadAllCount:
727                     ComboDispTitle.SelectedIndex = 4;
728                     break;
729                 case MyCommon.DispTitleEnum.UnreadAllRepCount:
730                     ComboDispTitle.SelectedIndex = 5;
731                     break;
732                 case MyCommon.DispTitleEnum.UnreadCountAllCount:
733                     ComboDispTitle.SelectedIndex = 6;
734                     break;
735                 case MyCommon.DispTitleEnum.OwnStatus:
736                     ComboDispTitle.SelectedIndex = 7;
737                     break;
738             }
739             CheckSortOrderLock.Checked = SortOrderLock;
740             CheckViewTabBottom.Checked = ViewTabBottom;
741             CheckTinyURL.Checked = TinyUrlResolve;
742             CheckForceResolve.Checked = ShortUrlForceResolve;
743             switch (_MyProxyType)
744             {
745                 case HttpConnection.ProxyType.None:
746                     RadioProxyNone.Checked = true;
747                     break;
748                 case HttpConnection.ProxyType.IE:
749                     RadioProxyIE.Checked = true;
750                     break;
751                 default:
752                     RadioProxySpecified.Checked = true;
753                     break;
754             }
755             bool chk = RadioProxySpecified.Checked;
756             LabelProxyAddress.Enabled = chk;
757             TextProxyAddress.Enabled = chk;
758             LabelProxyPort.Enabled = chk;
759             TextProxyPort.Enabled = chk;
760             LabelProxyUser.Enabled = chk;
761             TextProxyUser.Enabled = chk;
762             LabelProxyPassword.Enabled = chk;
763             TextProxyPassword.Enabled = chk;
764
765             TextProxyAddress.Text = ProxyAddress;
766             TextProxyPort.Text = ProxyPort.ToString();
767             TextProxyUser.Text = ProxyUser;
768             TextProxyPassword.Text = ProxyPassword;
769
770             CheckPeriodAdjust.Checked = PeriodAdjust;
771             CheckStartupVersion.Checked = StartupVersion;
772             CheckStartupFollowers.Checked = StartupFollowers;
773             CheckFavRestrict.Checked = RestrictFavCheck;
774             CheckAlwaysTop.Checked = AlwaysTop;
775             CheckAutoConvertUrl.Checked = UrlConvertAuto;
776             ShortenTcoCheck.Checked = ShortenTco;
777             ShortenTcoCheck.Enabled = CheckAutoConvertUrl.Checked;
778             CheckOutputz.Checked = OutputzEnabled;
779             TextBoxOutputzKey.Text = OutputzKey;
780
781             switch (OutputzUrlmode)
782             {
783                 case MyCommon.OutputzUrlmode.twittercom:
784                     ComboBoxOutputzUrlmode.SelectedIndex = 0;
785                     break;
786                 case MyCommon.OutputzUrlmode.twittercomWithUsername:
787                     ComboBoxOutputzUrlmode.SelectedIndex = 1;
788                     break;
789             }
790
791             CheckNicoms.Checked = Nicoms;
792             chkUnreadStyle.Checked = UseUnreadStyle;
793             CmbDateTimeFormat.Text = DateTimeFormat;
794             ConnectionTimeOut.Text = DefaultTimeOut.ToString();
795             CheckRetweetNoConfirm.Checked = RetweetNoConfirm;
796             CheckBalloonLimit.Checked = LimitBalloon;
797
798             ApplyEventNotifyFlag(EventNotifyEnabled, EventNotifyFlag, IsMyEventNotifyFlag);
799             CheckForceEventNotify.Checked = ForceEventNotify;
800             CheckFavEventUnread.Checked = FavEventUnread;
801             ComboBoxTranslateLanguage.SelectedIndex = (new Bing()).GetIndexFromLanguageEnum(TranslateLanguage);
802             SoundFileListup();
803             ComboBoxAutoShortUrlFirst.SelectedIndex = (int)AutoShortUrlFirst;
804             chkTabIconDisp.Checked = TabIconDisp;
805             chkReadOwnPost.Checked = ReadOwnPost;
806             chkGetFav.Checked = GetFav;
807             CheckMonospace.Checked = IsMonospace;
808             CheckReadOldPosts.Checked = ReadOldPosts;
809             CheckUseSsl.Checked = UseSsl;
810             TextBitlyId.Text = BitlyUser;
811             TextBitlyPw.Text = BitlyPwd;
812             TextBitlyId.Modified = false;
813             TextBitlyPw.Modified = false;
814             CheckShowGrid.Checked = ShowGrid;
815             CheckAtIdSupple.Checked = UseAtIdSupplement;
816             CheckHashSupple.Checked = UseHashSupplement;
817             CheckPreviewEnable.Checked = PreviewEnable;
818             TwitterAPIText.Text = TwitterApiUrl;
819             TwitterSearchAPIText.Text = TwitterSearchApiUrl;
820             switch (ReplyIconState)
821             {
822                 case MyCommon.REPLY_ICONSTATE.None:
823                     ReplyIconStateCombo.SelectedIndex = 0;
824                     break;
825                 case MyCommon.REPLY_ICONSTATE.StaticIcon:
826                     ReplyIconStateCombo.SelectedIndex = 1;
827                     break;
828                 case MyCommon.REPLY_ICONSTATE.BlinkIcon:
829                     ReplyIconStateCombo.SelectedIndex = 2;
830                     break;
831             }
832             switch (Language)
833             {
834                 case "OS":
835                     LanguageCombo.SelectedIndex = 0;
836                     break;
837                 case "ja":
838                     LanguageCombo.SelectedIndex = 1;
839                     break;
840                 case "en":
841                     LanguageCombo.SelectedIndex = 2;
842                     break;
843                 case "zh-CN":
844                     LanguageCombo.SelectedIndex = 3;
845                     break;
846                 default:
847                     LanguageCombo.SelectedIndex = 0;
848                     break;
849             }
850             HotkeyCheck.Checked = HotkeyEnabled;
851             HotkeyAlt.Checked = ((HotkeyMod & Keys.Alt) == Keys.Alt);
852             HotkeyCtrl.Checked = ((HotkeyMod & Keys.Control) == Keys.Control);
853             HotkeyShift.Checked = ((HotkeyMod & Keys.Shift) == Keys.Shift);
854             HotkeyWin.Checked = ((HotkeyMod & Keys.LWin) == Keys.LWin);
855             HotkeyCode.Text = HotkeyValue.ToString();
856             HotkeyText.Text = HotkeyKey.ToString();
857             HotkeyText.Tag = HotkeyKey;
858             HotkeyAlt.Enabled = HotkeyEnabled;
859             HotkeyShift.Enabled = HotkeyEnabled;
860             HotkeyCtrl.Enabled = HotkeyEnabled;
861             HotkeyWin.Enabled = HotkeyEnabled;
862             HotkeyText.Enabled = HotkeyEnabled;
863             HotkeyCode.Enabled = HotkeyEnabled;
864             ChkNewMentionsBlink.Checked = BlinkNewMentions;
865
866             CheckOutputz_CheckedChanged(sender, e);
867
868             GetMoreTextCountApi.Text = MoreCountApi.ToString();
869             FirstTextCountApi.Text = FirstCountApi.ToString();
870             SearchTextCountApi.Text = SearchCountApi.ToString();
871             FavoritesTextCountApi.Text = FavoritesCountApi.ToString();
872             UserTimelineTextCountApi.Text = UserTimelineCountApi.ToString();
873             ListTextCountApi.Text = ListCountApi.ToString();
874             UseChangeGetCount.Checked = UseAdditionalCount;
875             Label28.Enabled = UseChangeGetCount.Checked;
876             Label30.Enabled = UseChangeGetCount.Checked;
877             Label53.Enabled = UseChangeGetCount.Checked;
878             Label66.Enabled = UseChangeGetCount.Checked;
879             Label17.Enabled = UseChangeGetCount.Checked;
880             Label25.Enabled = UseChangeGetCount.Checked;
881             GetMoreTextCountApi.Enabled = UseChangeGetCount.Checked;
882             FirstTextCountApi.Enabled = UseChangeGetCount.Checked;
883             SearchTextCountApi.Enabled = UseChangeGetCount.Checked;
884             FavoritesTextCountApi.Enabled = UseChangeGetCount.Checked;
885             UserTimelineTextCountApi.Enabled = UseChangeGetCount.Checked;
886             ListTextCountApi.Enabled = UseChangeGetCount.Checked;
887             CheckOpenUserTimeline.Checked = OpenUserTimeline;
888             ListDoubleClickActionComboBox.SelectedIndex = ListDoubleClickAction;
889             UserAppointUrlText.Text = UserAppointUrl;
890             this.HideDuplicatedRetweetsCheck.Checked = this.HideDuplicatedRetweets;
891             this.IsPreviewFoursquareCheckBox.Checked = this.IsPreviewFoursquare;
892             this.MapThumbnailProviderComboBox.SelectedIndex = (int)this.MapThumbnailProvider;
893             this.MapThumbnailHeightTextBox.Text = this.MapThumbnailHeight.ToString();
894             this.MapThumbnailWidthTextBox.Text = this.MapThumbnailWidth.ToString();
895             this.MapThumbnailZoomTextBox.Text = this.MapThumbnailZoom.ToString();
896             this.IsListsIncludeRtsCheckBox.Checked = this.IsListStatusesIncludeRts;
897             this.TabMouseLockCheck.Checked = this.TabMouseLock;
898             this.IsRemoveSameFavEventCheckBox.Checked = this.IsRemoveSameEvent;
899             this.IsNotifyUseGrowlCheckBox.Checked = this.IsNotifyUseGrowl;
900
901             if (GrowlHelper.IsDllExists)
902             {
903                 IsNotifyUseGrowlCheckBox.Enabled = true;
904             }
905             else
906             {
907                 IsNotifyUseGrowlCheckBox.Enabled = false;
908             }
909
910             this.TreeViewSetting.Nodes["BasedNode"].Tag = BasedPanel;
911             this.TreeViewSetting.Nodes["BasedNode"].Nodes["PeriodNode"].Tag = GetPeriodPanel;
912             this.TreeViewSetting.Nodes["BasedNode"].Nodes["StartUpNode"].Tag = StartupPanel;
913             this.TreeViewSetting.Nodes["BasedNode"].Nodes["GetCountNode"].Tag = GetCountPanel;
914             //this.TreeViewSetting.Nodes["BasedNode"].Nodes["UserStreamNode"].Tag = UserStreamPanel;
915             this.TreeViewSetting.Nodes["ActionNode"].Tag = ActionPanel;
916             this.TreeViewSetting.Nodes["ActionNode"].Nodes["TweetActNode"].Tag = TweetActPanel;
917             this.TreeViewSetting.Nodes["PreviewNode"].Tag = PreviewPanel;
918             this.TreeViewSetting.Nodes["PreviewNode"].Nodes["TweetPrvNode"].Tag = TweetPrvPanel;
919             this.TreeViewSetting.Nodes["PreviewNode"].Nodes["NotifyNode"].Tag = NotifyPanel;
920             this.TreeViewSetting.Nodes["FontNode"].Tag = FontPanel;
921             this.TreeViewSetting.Nodes["FontNode"].Nodes["FontNode2"].Tag = FontPanel2;
922             this.TreeViewSetting.Nodes["ConnectionNode"].Tag = ConnectionPanel;
923             this.TreeViewSetting.Nodes["ConnectionNode"].Nodes["ProxyNode"].Tag = ProxyPanel;
924             this.TreeViewSetting.Nodes["ConnectionNode"].Nodes["CooperateNode"].Tag = CooperatePanel;
925             this.TreeViewSetting.Nodes["ConnectionNode"].Nodes["ShortUrlNode"].Tag = ShortUrlPanel;
926
927             this.TreeViewSetting.SelectedNode = this.TreeViewSetting.Nodes[0];
928             this.TreeViewSetting.ExpandAll();
929
930             //TreeViewSetting.SelectedNode = TreeViewSetting.TopNode;
931             ActiveControl = StartAuthButton;
932         }
933
934         private void UserstreamPeriod_Validating(object sender, CancelEventArgs e)
935         {
936             int prd;
937             try
938             {
939                 prd = int.Parse(UserstreamPeriod.Text);
940             }
941             catch(Exception)
942             {
943                 MessageBox.Show(Properties.Resources.UserstreamPeriod_ValidatingText1);
944                 e.Cancel = true;
945                 return;
946             }
947
948             if (prd < 0 || prd > 60)
949             {
950                 MessageBox.Show(Properties.Resources.UserstreamPeriod_ValidatingText1);
951                 e.Cancel = true;
952                 return;
953             }
954             CalcApiUsing();
955         }
956
957         private void TimelinePeriod_Validating(object sender, CancelEventArgs e)
958         {
959             int prd;
960             try
961             {
962                 prd = int.Parse(TimelinePeriod.Text);
963             }
964             catch(Exception)
965             {
966                 MessageBox.Show(Properties.Resources.TimelinePeriod_ValidatingText1);
967                 e.Cancel = true;
968                 return;
969             }
970
971             if (prd != 0 && (prd < 15 || prd > 6000))
972             {
973                 MessageBox.Show(Properties.Resources.TimelinePeriod_ValidatingText2);
974                 e.Cancel = true;
975                 return;
976             }
977             CalcApiUsing();
978         }
979
980         private void ReplyPeriod_Validating(object sender, CancelEventArgs e)
981         {
982             int prd;
983             try
984             {
985                 prd = int.Parse(ReplyPeriod.Text);
986             }
987             catch(Exception)
988             {
989                 MessageBox.Show(Properties.Resources.TimelinePeriod_ValidatingText1);
990                 e.Cancel = true;
991                 return;
992             }
993
994             if (prd != 0 && (prd < 15 || prd > 6000))
995             {
996                 MessageBox.Show(Properties.Resources.TimelinePeriod_ValidatingText2);
997                 e.Cancel = true;
998                 return;
999             }
1000             CalcApiUsing();
1001         }
1002
1003         private void DMPeriod_Validating(object sender, CancelEventArgs e)
1004         {
1005             int prd;
1006             try
1007             {
1008                 prd = int.Parse(DMPeriod.Text);
1009             }
1010             catch(Exception)
1011             {
1012                 MessageBox.Show(Properties.Resources.DMPeriod_ValidatingText1);
1013                 e.Cancel = true;
1014                 return;
1015             }
1016
1017             if (prd != 0 && (prd < 15 || prd > 6000))
1018             {
1019                 MessageBox.Show(Properties.Resources.DMPeriod_ValidatingText2);
1020                 e.Cancel = true;
1021                 return;
1022             }
1023             CalcApiUsing();
1024         }
1025
1026         private void PubSearchPeriod_Validating(object sender, CancelEventArgs e)
1027         {
1028             int prd;
1029             try
1030             {
1031                 prd = int.Parse(PubSearchPeriod.Text);
1032             }
1033             catch(Exception)
1034             {
1035                 MessageBox.Show(Properties.Resources.PubSearchPeriod_ValidatingText1);
1036                 e.Cancel = true;
1037                 return;
1038             }
1039
1040             if (prd != 0 && (prd < 30 || prd > 6000))
1041             {
1042                 MessageBox.Show(Properties.Resources.PubSearchPeriod_ValidatingText2);
1043                 e.Cancel = true;
1044             }
1045         }
1046
1047         private void ListsPeriod_Validating(object sender, CancelEventArgs e)
1048         {
1049             int prd;
1050             try
1051             {
1052                 prd = int.Parse(ListsPeriod.Text);
1053             }
1054             catch(Exception)
1055             {
1056                 MessageBox.Show(Properties.Resources.DMPeriod_ValidatingText1);
1057                 e.Cancel = true;
1058                 return;
1059             }
1060
1061             if (prd != 0 && (prd < 15 || prd > 6000))
1062             {
1063                 MessageBox.Show(Properties.Resources.DMPeriod_ValidatingText2);
1064                 e.Cancel = true;
1065                 return;
1066             }
1067             CalcApiUsing();
1068         }
1069
1070         private void UserTimeline_Validating(object sender, CancelEventArgs e)
1071         {
1072             int prd;
1073             try
1074             {
1075                 prd = int.Parse(UserTimelinePeriod.Text);
1076             }
1077             catch(Exception)
1078             {
1079                 MessageBox.Show(Properties.Resources.DMPeriod_ValidatingText1);
1080                 e.Cancel = true;
1081                 return;
1082             }
1083
1084             if (prd != 0 && (prd < 15 || prd > 6000))
1085             {
1086                 MessageBox.Show(Properties.Resources.DMPeriod_ValidatingText2);
1087                 e.Cancel = true;
1088                 return;
1089             }
1090             CalcApiUsing();
1091         }
1092
1093         private void UReadMng_CheckedChanged(object sender, EventArgs e)
1094         {
1095             if (UReadMng.Checked == true)
1096             {
1097                 StartupReaded.Enabled = true;
1098             }
1099             else
1100             {
1101                 StartupReaded.Enabled = false;
1102             }
1103         }
1104
1105         private void btnFontAndColor_Click(object sender, EventArgs e) // Handles btnUnread.Click, btnDetail.Click, btnListFont.Click, btnInputFont.Click
1106         {
1107             Button Btn = (Button) sender;
1108             DialogResult rtn;
1109
1110             FontDialog1.AllowVerticalFonts = false;
1111             FontDialog1.AllowScriptChange = true;
1112             FontDialog1.AllowSimulations = true;
1113             FontDialog1.AllowVectorFonts = true;
1114             FontDialog1.FixedPitchOnly = false;
1115             FontDialog1.FontMustExist = true;
1116             FontDialog1.ScriptsOnly = false;
1117             FontDialog1.ShowApply = false;
1118             FontDialog1.ShowEffects = true;
1119             FontDialog1.ShowColor = true;
1120
1121             switch (Btn.Name)
1122             {
1123                 case "btnUnread":
1124                     FontDialog1.Color = lblUnread.ForeColor;
1125                     FontDialog1.Font = lblUnread.Font;
1126                     break;
1127                 case "btnDetail":
1128                     FontDialog1.Color = lblDetail.ForeColor;
1129                     FontDialog1.Font = lblDetail.Font;
1130                     break;
1131                 case "btnListFont":
1132                     FontDialog1.Color = lblListFont.ForeColor;
1133                     FontDialog1.Font = lblListFont.Font;
1134                     break;
1135                 case "btnInputFont":
1136                     FontDialog1.Color = lblInputFont.ForeColor;
1137                     FontDialog1.Font = lblInputFont.Font;
1138                     break;
1139             }
1140
1141             try
1142             {
1143                 rtn = FontDialog1.ShowDialog();
1144             }
1145             catch(ArgumentException ex)
1146             {
1147                 MessageBox.Show(ex.Message);
1148                 return;
1149             }
1150
1151             if (rtn == DialogResult.Cancel) return;
1152
1153             switch (Btn.Name)
1154             {
1155                 case "btnUnread":
1156                     lblUnread.ForeColor = FontDialog1.Color;
1157                     lblUnread.Font = FontDialog1.Font;
1158                     break;
1159                 case "btnDetail":
1160                     lblDetail.ForeColor = FontDialog1.Color;
1161                     lblDetail.Font = FontDialog1.Font;
1162                     break;
1163                 case "btnListFont":
1164                     lblListFont.ForeColor = FontDialog1.Color;
1165                     lblListFont.Font = FontDialog1.Font;
1166                     break;
1167                 case "btnInputFont":
1168                     lblInputFont.ForeColor = FontDialog1.Color;
1169                     lblInputFont.Font = FontDialog1.Font;
1170                     break;
1171             }
1172
1173         }
1174
1175         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
1176         {
1177             Button Btn = (Button)sender;
1178             DialogResult rtn;
1179
1180             ColorDialog1.AllowFullOpen = true;
1181             ColorDialog1.AnyColor = true;
1182             ColorDialog1.FullOpen = false;
1183             ColorDialog1.SolidColorOnly = false;
1184
1185             switch (Btn.Name)
1186             {
1187                 case "btnSelf":
1188                     ColorDialog1.Color = lblSelf.BackColor;
1189                     break;
1190                 case "btnAtSelf":
1191                     ColorDialog1.Color = lblAtSelf.BackColor;
1192                     break;
1193                 case "btnTarget":
1194                     ColorDialog1.Color = lblTarget.BackColor;
1195                     break;
1196                 case "btnAtTarget":
1197                     ColorDialog1.Color = lblAtTarget.BackColor;
1198                     break;
1199                 case "btnAtFromTarget":
1200                     ColorDialog1.Color = lblAtFromTarget.BackColor;
1201                     break;
1202                 case "btnFav":
1203                     ColorDialog1.Color = lblFav.ForeColor;
1204                     break;
1205                 case "btnOWL":
1206                     ColorDialog1.Color = lblOWL.ForeColor;
1207                     break;
1208                 case "btnRetweet":
1209                     ColorDialog1.Color = lblRetweet.ForeColor;
1210                     break;
1211                 case "btnInputBackcolor":
1212                     ColorDialog1.Color = lblInputBackcolor.BackColor;
1213                     break;
1214                 case "btnAtTo":
1215                     ColorDialog1.Color = lblAtTo.BackColor;
1216                     break;
1217                 case "btnListBack":
1218                     ColorDialog1.Color = lblListBackcolor.BackColor;
1219                     break;
1220                 case "btnDetailBack":
1221                     ColorDialog1.Color = lblDetailBackcolor.BackColor;
1222                     break;
1223                 case "btnDetailLink":
1224                     ColorDialog1.Color = lblDetailLink.ForeColor;
1225                     break;
1226             }
1227
1228             rtn = ColorDialog1.ShowDialog();
1229
1230             if (rtn == DialogResult.Cancel) return;
1231
1232             switch (Btn.Name)
1233             {
1234                 case "btnSelf":
1235                     lblSelf.BackColor = ColorDialog1.Color;
1236                     break;
1237                 case "btnAtSelf":
1238                     lblAtSelf.BackColor = ColorDialog1.Color;
1239                     break;
1240                 case "btnTarget":
1241                     lblTarget.BackColor = ColorDialog1.Color;
1242                     break;
1243                 case "btnAtTarget":
1244                     lblAtTarget.BackColor = ColorDialog1.Color;
1245                     break;
1246                 case "btnAtFromTarget":
1247                     lblAtFromTarget.BackColor = ColorDialog1.Color;
1248                     break;
1249                 case "btnFav":
1250                     lblFav.ForeColor = ColorDialog1.Color;
1251                     break;
1252                 case "btnOWL":
1253                     lblOWL.ForeColor = ColorDialog1.Color;
1254                     break;
1255                 case "btnRetweet":
1256                     lblRetweet.ForeColor = ColorDialog1.Color;
1257                     break;
1258                 case "btnInputBackcolor":
1259                     lblInputBackcolor.BackColor = ColorDialog1.Color;
1260                     break;
1261                 case "btnAtTo":
1262                     lblAtTo.BackColor = ColorDialog1.Color;
1263                     break;
1264                 case "btnListBack":
1265                     lblListBackcolor.BackColor = ColorDialog1.Color;
1266                     break;
1267                 case "btnDetailBack":
1268                     lblDetailBackcolor.BackColor = ColorDialog1.Color;
1269                     break;
1270                 case "btnDetailLink":
1271                     lblDetailLink.ForeColor = ColorDialog1.Color;
1272                     break;
1273             }
1274         }
1275
1276         public int UserstreamPeriodInt { get; set; }
1277         public bool UserstreamStartup { get; set; }
1278         public int TimelinePeriodInt { get; set; }
1279         public int ReplyPeriodInt { get; set; }
1280         public int DMPeriodInt { get; set; }
1281         public int PubSearchPeriodInt { get; set; }
1282         public int ListsPeriodInt { get; set; }
1283         public int UserTimelinePeriodInt { get; set; }
1284         public bool Readed { get; set; }
1285         public MyCommon.IconSizes IconSz { get; set; }
1286         public string Status { get; set; }
1287         public bool UnreadManage { get; set; }
1288         public bool PlaySound { get; set; }
1289         public bool OneWayLove { get; set; }
1290         public Font FontUnread { get; set; } /////未使用
1291         public Color ColorUnread { get; set; }
1292         public Font FontReaded { get; set; } /////リストフォントとして使用
1293         public Color ColorReaded { get; set; }
1294         public Color ColorFav { get; set; }
1295         public Color ColorOWL { get; set; }
1296         public Color ColorRetweet { get; set; }
1297         public Font FontDetail { get; set; }
1298         public Color ColorDetail { get; set; }
1299         public Color ColorDetailLink { get; set; }
1300         public Color ColorSelf { get; set; }
1301         public Color ColorAtSelf { get; set; }
1302         public Color ColorTarget { get; set; }
1303         public Color ColorAtTarget { get; set; }
1304         public Color ColorAtFromTarget { get; set; }
1305         public Color ColorAtTo { get; set; }
1306         public Color ColorInputBackcolor { get; set; }
1307         public Color ColorInputFont { get; set; }
1308         public Font FontInputFont { get; set; }
1309         public Color ColorListBackcolor { get; set; }
1310         public Color ColorDetailBackcolor { get; set; }
1311         public MyCommon.NameBalloonEnum NameBalloon { get; set; }
1312         public bool PostCtrlEnter { get; set; }
1313         public bool PostShiftEnter { get; set; }
1314         public int CountApi { get; set; }
1315         public int CountApiReply { get; set; }
1316         public int MoreCountApi { get; set; }
1317         public int FirstCountApi { get; set; }
1318         public int SearchCountApi { get; set; }
1319         public int FavoritesCountApi { get; set; }
1320         public int UserTimelineCountApi { get; set; }
1321         public int ListCountApi { get; set; }
1322         public bool PostAndGet { get; set; }
1323         public bool UseRecommendStatus { get; set; }
1324         public string RecommendStatusText { get; set; }
1325         public bool DispUsername { get; set; }
1326         public bool CloseToExit { get; set; }
1327         public bool MinimizeToTray { get; set; }
1328         public MyCommon.DispTitleEnum DispLatestPost { get; set; }
1329         public string BrowserPath { get; set; }
1330         public bool TinyUrlResolve { get; set; }
1331         public bool ShortUrlForceResolve { get; set; }
1332
1333         private void CheckUseRecommendStatus_CheckedChanged(object sender, EventArgs e)
1334         {
1335             if (CheckUseRecommendStatus.Checked == true)
1336             {
1337                 StatusText.Enabled = false;
1338             }
1339             else
1340             {
1341                 StatusText.Enabled = true;
1342             }
1343         }
1344
1345         public bool SortOrderLock { get; set; }
1346         public HttpConnection.ProxyType SelectedProxyType
1347         {
1348             get {
1349                 return _MyProxyType;
1350             }
1351             set {
1352                 _MyProxyType = value;
1353             }
1354         }
1355         /// <summary>
1356         /// タブを下部に表示するかどうかを取得または設定する
1357         /// </summary>
1358         public bool ViewTabBottom { get; set; }
1359
1360         public string ProxyAddress { get; set; }
1361         public int ProxyPort { get; set; }
1362         public string ProxyUser { get; set; }
1363         public string ProxyPassword { get; set; }
1364         public bool PeriodAdjust { get; set; }
1365         public bool StartupVersion { get; set; }
1366         public bool StartupFollowers { get; set; }
1367         public bool RestrictFavCheck { get; set; }
1368         public bool AlwaysTop { get; set; }
1369         public bool UrlConvertAuto { get; set; }
1370         public bool ShortenTco { get; set; }
1371         public bool OutputzEnabled { get; set; }
1372         public string OutputzKey { get; set; }
1373         public MyCommon.OutputzUrlmode OutputzUrlmode { get; set; }
1374         public bool Nicoms { get; set; }
1375         public MyCommon.UrlConverter AutoShortUrlFirst { get; set; }
1376         public bool UseUnreadStyle { get; set; }
1377         public string DateTimeFormat { get; set; }
1378         public int DefaultTimeOut { get; set; }
1379         public bool RetweetNoConfirm { get; set; }
1380         public bool TabIconDisp { get; set; }
1381         public MyCommon.REPLY_ICONSTATE ReplyIconState { get; set; }
1382         public bool ReadOwnPost { get; set; }
1383         public bool GetFav { get; set; }
1384         public bool IsMonospace { get; set; }
1385         public bool ReadOldPosts { get; set; }
1386         public bool UseSsl { get; set; }
1387         public string BitlyUser { get; set; }
1388         public string BitlyPwd { get; set; }
1389         public bool ShowGrid { get; set; }
1390         public bool UseAtIdSupplement { get; set; }
1391         public bool UseHashSupplement { get; set; }
1392         public bool PreviewEnable { get; set; }
1393         public bool UseAdditionalCount { get; set; }
1394         public bool OpenUserTimeline { get; set; }
1395         public string TwitterApiUrl { get; set; }
1396         public string TwitterSearchApiUrl { get; set; }
1397         public string Language { get; set; }
1398
1399         private void Button3_Click(object sender, EventArgs e)
1400         {
1401             using (OpenFileDialog filedlg = new OpenFileDialog())
1402             {
1403                 filedlg.Filter = Properties.Resources.Button3_ClickText1;
1404                 filedlg.FilterIndex = 1;
1405                 filedlg.Title = Properties.Resources.Button3_ClickText2;
1406                 filedlg.RestoreDirectory = true;
1407
1408                 if (filedlg.ShowDialog() == DialogResult.OK)
1409                 {
1410                     BrowserPathText.Text = filedlg.FileName;
1411                 }
1412             }
1413         }
1414
1415         private void RadioProxySpecified_CheckedChanged(object sender, EventArgs e)
1416         {
1417             bool chk = RadioProxySpecified.Checked;
1418             LabelProxyAddress.Enabled = chk;
1419             TextProxyAddress.Enabled = chk;
1420             LabelProxyPort.Enabled = chk;
1421             TextProxyPort.Enabled = chk;
1422             LabelProxyUser.Enabled = chk;
1423             TextProxyUser.Enabled = chk;
1424             LabelProxyPassword.Enabled = chk;
1425             TextProxyPassword.Enabled = chk;
1426         }
1427
1428         private void TextProxyPort_Validating(object sender, CancelEventArgs e)
1429         {
1430             int port;
1431             if (string.IsNullOrWhiteSpace(TextProxyPort.Text)) TextProxyPort.Text = "0";
1432             if (int.TryParse(TextProxyPort.Text.Trim(), out port) == false)
1433             {
1434                 MessageBox.Show(Properties.Resources.TextProxyPort_ValidatingText1);
1435                 e.Cancel = true;
1436                 return;
1437             }
1438             if (port < 0 || port > 65535)
1439             {
1440                 MessageBox.Show(Properties.Resources.TextProxyPort_ValidatingText2);
1441                 e.Cancel = true;
1442                 return;
1443             }
1444         }
1445
1446         private void CheckOutputz_CheckedChanged(object sender, EventArgs e)
1447         {
1448             if (CheckOutputz.Checked == true)
1449             {
1450                 Label59.Enabled = true;
1451                 Label60.Enabled = true;
1452                 TextBoxOutputzKey.Enabled = true;
1453                 ComboBoxOutputzUrlmode.Enabled = true;
1454             }
1455             else
1456             {
1457                 Label59.Enabled = false;
1458                 Label60.Enabled = false;
1459                 TextBoxOutputzKey.Enabled = false;
1460                 ComboBoxOutputzUrlmode.Enabled = false;
1461             }
1462         }
1463
1464         private void TextBoxOutputzKey_Validating(object sender, CancelEventArgs e)
1465         {
1466             if (CheckOutputz.Checked)
1467             {
1468                 TextBoxOutputzKey.Text = TextBoxOutputzKey.Text.Trim();
1469                 if (TextBoxOutputzKey.Text.Length == 0)
1470                 {
1471                     MessageBox.Show(Properties.Resources.TextBoxOutputzKey_Validating);
1472                     e.Cancel = true;
1473                     return;
1474                 }
1475             }
1476         }
1477
1478         private bool CreateDateTimeFormatSample()
1479         {
1480             try
1481             {
1482                 LabelDateTimeFormatApplied.Text = DateTime.Now.ToString(CmbDateTimeFormat.Text);
1483             }
1484             catch(FormatException)
1485             {
1486                 LabelDateTimeFormatApplied.Text = Properties.Resources.CreateDateTimeFormatSampleText1;
1487                 return false;
1488             }
1489             return true;
1490         }
1491
1492         private void CmbDateTimeFormat_TextUpdate(object sender, EventArgs e)
1493         {
1494             CreateDateTimeFormatSample();
1495         }
1496
1497         private void CmbDateTimeFormat_SelectedIndexChanged(object sender, EventArgs e)
1498         {
1499             CreateDateTimeFormatSample();
1500         }
1501
1502         private void CmbDateTimeFormat_Validating(object sender, CancelEventArgs e)
1503         {
1504             if (!CreateDateTimeFormatSample())
1505             {
1506                 MessageBox.Show(Properties.Resources.CmbDateTimeFormat_Validating);
1507                 e.Cancel = true;
1508             }
1509         }
1510
1511         private void ConnectionTimeOut_Validating(object sender, CancelEventArgs e)
1512         {
1513             int tm;
1514             try
1515             {
1516                 tm = int.Parse(ConnectionTimeOut.Text);
1517             }
1518             catch(Exception)
1519             {
1520                 MessageBox.Show(Properties.Resources.ConnectionTimeOut_ValidatingText1);
1521                 e.Cancel = true;
1522                 return;
1523             }
1524
1525             if (tm < (int)MyCommon.HttpTimeOut.MinValue || tm > (int)MyCommon.HttpTimeOut.MaxValue)
1526             {
1527                 MessageBox.Show(Properties.Resources.ConnectionTimeOut_ValidatingText1);
1528                 e.Cancel = true;
1529             }
1530         }
1531
1532         private void LabelDateTimeFormatApplied_VisibleChanged(object sender, EventArgs e)
1533         {
1534             CreateDateTimeFormatSample();
1535         }
1536
1537         private void TextCountApi_Validating(object sender, CancelEventArgs e)
1538         {
1539             int cnt;
1540             try
1541             {
1542                 cnt = int.Parse(TextCountApi.Text);
1543             }
1544             catch(Exception)
1545             {
1546                 MessageBox.Show(Properties.Resources.TextCountApi_Validating1);
1547                 e.Cancel = true;
1548                 return;
1549             }
1550
1551             if (cnt < 20 || cnt > 200)
1552             {
1553                 MessageBox.Show(Properties.Resources.TextCountApi_Validating1);
1554                 e.Cancel = true;
1555                 return;
1556             }
1557         }
1558
1559         private void TextCountApiReply_Validating(object sender, CancelEventArgs e)
1560         {
1561             int cnt;
1562             try
1563             {
1564                 cnt = int.Parse(TextCountApiReply.Text);
1565             }
1566             catch(Exception)
1567             {
1568                 MessageBox.Show(Properties.Resources.TextCountApi_Validating1);
1569                 e.Cancel = true;
1570                 return;
1571             }
1572
1573             if (cnt < 20 || cnt > 200)
1574             {
1575                 MessageBox.Show(Properties.Resources.TextCountApi_Validating1);
1576                 e.Cancel = true;
1577                 return;
1578             }
1579         }
1580
1581         public bool LimitBalloon { get; set; }
1582         public bool EventNotifyEnabled { get; set; }
1583
1584         public MyCommon.EVENTTYPE EventNotifyFlag
1585         {
1586             get
1587             {
1588                 return _MyEventNotifyFlag;
1589             }
1590             set
1591             {
1592                 _MyEventNotifyFlag = value;
1593             }
1594         }
1595
1596         public MyCommon.EVENTTYPE IsMyEventNotifyFlag
1597         {
1598             get
1599             {
1600                 return _isMyEventNotifyFlag;
1601             }
1602             set
1603             {
1604                 _isMyEventNotifyFlag = value;
1605             }
1606         }
1607
1608         public bool ForceEventNotify { get; set; }
1609         public bool FavEventUnread { get; set; }
1610
1611         public string TranslateLanguage
1612         {
1613             get
1614             {
1615                 return _MyTranslateLanguage;
1616             }
1617             set
1618             {
1619                 _MyTranslateLanguage = value;
1620                 ComboBoxTranslateLanguage.SelectedIndex = (new Bing()).GetIndexFromLanguageEnum(value);
1621             }
1622         }
1623
1624         public string EventSoundFile { get; set; }
1625         public int ListDoubleClickAction { get; set; }
1626         public string UserAppointUrl { get; set; }
1627
1628         private void ComboBoxAutoShortUrlFirst_SelectedIndexChanged(object sender, EventArgs e)
1629         {
1630             if (ComboBoxAutoShortUrlFirst.SelectedIndex == (int)MyCommon.UrlConverter.Bitly ||
1631                ComboBoxAutoShortUrlFirst.SelectedIndex == (int)MyCommon.UrlConverter.Jmp)
1632             {
1633                 Label76.Enabled = true;
1634                 Label77.Enabled = true;
1635                 TextBitlyId.Enabled = true;
1636                 TextBitlyPw.Enabled = true;
1637             }
1638             else
1639             {
1640                 Label76.Enabled = false;
1641                 Label77.Enabled = false;
1642                 TextBitlyId.Enabled = false;
1643                 TextBitlyPw.Enabled = false;
1644             }
1645         }
1646
1647         private void ButtonBackToDefaultFontColor_Click(object sender, EventArgs e) //Handles ButtonBackToDefaultFontColor.Click, ButtonBackToDefaultFontColor2.Click
1648         {
1649             lblUnread.ForeColor = SystemColors.ControlText;
1650             lblUnread.Font = new Font(SystemFonts.DefaultFont, FontStyle.Bold | FontStyle.Underline);
1651
1652             lblListFont.ForeColor = System.Drawing.SystemColors.ControlText;
1653             lblListFont.Font = System.Drawing.SystemFonts.DefaultFont;
1654
1655             lblDetail.ForeColor = Color.FromKnownColor(System.Drawing.KnownColor.ControlText);
1656             lblDetail.Font = System.Drawing.SystemFonts.DefaultFont;
1657
1658             lblInputFont.ForeColor = Color.FromKnownColor(System.Drawing.KnownColor.ControlText);
1659             lblInputFont.Font = System.Drawing.SystemFonts.DefaultFont;
1660
1661             lblSelf.BackColor = Color.FromKnownColor(System.Drawing.KnownColor.AliceBlue);
1662
1663             lblAtSelf.BackColor = Color.FromKnownColor(System.Drawing.KnownColor.AntiqueWhite);
1664
1665             lblTarget.BackColor = Color.FromKnownColor(System.Drawing.KnownColor.LemonChiffon);
1666
1667             lblAtTarget.BackColor = Color.FromKnownColor(System.Drawing.KnownColor.LavenderBlush);
1668
1669             lblAtFromTarget.BackColor = Color.FromKnownColor(System.Drawing.KnownColor.Honeydew);
1670
1671             lblFav.ForeColor = Color.FromKnownColor(System.Drawing.KnownColor.Red);
1672
1673             lblOWL.ForeColor = Color.FromKnownColor(System.Drawing.KnownColor.Blue);
1674
1675             lblInputBackcolor.BackColor = Color.FromKnownColor(System.Drawing.KnownColor.LemonChiffon);
1676
1677             lblAtTo.BackColor = Color.FromKnownColor(System.Drawing.KnownColor.Pink);
1678
1679             lblListBackcolor.BackColor = Color.FromKnownColor(System.Drawing.KnownColor.Window);
1680
1681             lblDetailBackcolor.BackColor = Color.FromKnownColor(System.Drawing.KnownColor.Window);
1682
1683             lblDetailLink.ForeColor = Color.FromKnownColor(System.Drawing.KnownColor.Blue);
1684
1685             lblRetweet.ForeColor = Color.FromKnownColor(System.Drawing.KnownColor.Green);
1686         }
1687
1688         private bool StartAuth()
1689         {
1690             //現在の設定内容で通信
1691             HttpConnection.ProxyType ptype;
1692             if (RadioProxyNone.Checked)
1693             {
1694                 ptype = HttpConnection.ProxyType.None;
1695             }
1696             else if (RadioProxyIE.Checked)
1697             {
1698                 ptype = HttpConnection.ProxyType.IE;
1699             }
1700             else
1701             {
1702                 ptype = HttpConnection.ProxyType.Specified;
1703             }
1704             string padr = TextProxyAddress.Text.Trim();
1705             int pport = int.Parse(TextProxyPort.Text.Trim());
1706             string pusr = TextProxyUser.Text.Trim();
1707             string ppw = TextProxyPassword.Text.Trim();
1708
1709             //通信基底クラス初期化
1710             HttpConnection.InitializeConnection(20, ptype, padr, pport, pusr, ppw);
1711             HttpTwitter.TwitterUrl = TwitterAPIText.Text.Trim();
1712             HttpTwitter.TwitterSearchUrl = TwitterSearchAPIText.Text.Trim();
1713             tw.Initialize("", "", "", 0);
1714             //this.AuthStateLabel.Text = Properties.Resources.AuthorizeButton_Click4;
1715             //this.AuthUserLabel.Text = "";
1716             string pinPageUrl = "";
1717             string rslt = tw.StartAuthentication(ref pinPageUrl);
1718             if (string.IsNullOrEmpty(rslt))
1719             {
1720                 string pin = AuthDialog.DoAuth(this, pinPageUrl);
1721                 if (!string.IsNullOrEmpty(pin))
1722                 {
1723                     this._pin = pin;
1724                     return true;
1725                 }
1726                 else
1727                 {
1728                     return false;
1729                 }
1730             }
1731             else
1732             {
1733                 MessageBox.Show(Properties.Resources.AuthorizeButton_Click2 + Environment.NewLine + rslt, "Authenticate", MessageBoxButtons.OK);
1734                 return false;
1735             }
1736         }
1737
1738         private bool PinAuth()
1739         {
1740             string pin = this._pin;   //PIN Code
1741
1742             string rslt = tw.Authenticate(pin);
1743             if (string.IsNullOrEmpty(rslt))
1744             {
1745                 MessageBox.Show(Properties.Resources.AuthorizeButton_Click1, "Authenticate", MessageBoxButtons.OK);
1746                 //this.AuthStateLabel.Text = Properties.Resources.AuthorizeButton_Click3;
1747                 //this.AuthUserLabel.Text = tw.Username;
1748                 int idx = -1;
1749                 UserAccount user = new UserAccount();
1750                 user.Username = tw.Username;
1751                 user.UserId = tw.UserId;
1752                 user.Token = tw.AccessToken;
1753                 user.TokenSecret = tw.AccessTokenSecret;
1754
1755                 foreach (object u in this.AuthUserCombo.Items)
1756                 {
1757                     if (((UserAccount)u).Username.ToLower() == tw.Username.ToLower())
1758                     {
1759                         idx = this.AuthUserCombo.Items.IndexOf(u);
1760                         break;
1761                     }
1762                 }
1763                 if (idx > -1)
1764                 {
1765                     this.AuthUserCombo.Items.RemoveAt(idx);
1766                     this.AuthUserCombo.Items.Insert(idx, user);
1767                     this.AuthUserCombo.SelectedIndex = idx;
1768                 }
1769                 else
1770                 {
1771                     this.AuthUserCombo.SelectedIndex = this.AuthUserCombo.Items.Add(user);
1772                 }
1773                 //if (TwitterApiInfo.AccessLevel = ApiAccessLevel.ReadWrite)
1774                 //{
1775                 //    this.AuthStateLabel.Text += "(xAuth)";
1776                 //}
1777                 //else if (TwitterApiInfo.AccessLevel == ApiAccessLevel.ReadWriteAndDirectMessage)
1778                 //{
1779                 //    this.AuthStateLabel.Text += "(OAuth)";
1780                 //}
1781                 return true;
1782             }
1783             else
1784             {
1785                 MessageBox.Show(Properties.Resources.AuthorizeButton_Click2 + Environment.NewLine + rslt, "Authenticate", MessageBoxButtons.OK);
1786                 //this.AuthStateLabel.Text = Properties.Resources.AuthorizeButton_Click4;
1787                 //this.AuthUserLabel.Text = "";
1788                 return false;
1789             }
1790         }
1791
1792         private void StartAuthButton_Click(object sender, EventArgs e)
1793         {
1794             //this.Save.Enabled = false;
1795             if (StartAuth())
1796             {
1797                 if (PinAuth())
1798                 {
1799                     CalcApiUsing();
1800                     //this.Save.Enabled = true;
1801                 }
1802             }
1803         }
1804
1805         private void AuthClearButton_Click(object sender, EventArgs e)
1806         {
1807             //tw.ClearAuthInfo();
1808             //this.AuthStateLabel.Text = Properties.Resources.AuthorizeButton_Click4;
1809             //this.AuthUserLabel.Text = "";
1810             if (this.AuthUserCombo.SelectedIndex > -1)
1811             {
1812                 this.AuthUserCombo.Items.RemoveAt(this.AuthUserCombo.SelectedIndex);
1813                 if (this.AuthUserCombo.Items.Count > 0)
1814                 {
1815                     this.AuthUserCombo.SelectedIndex = 0;
1816                 }
1817                 else
1818                 {
1819                     this.AuthUserCombo.SelectedIndex = -1;
1820                 }
1821             }
1822             //this.Save.Enabled = false;
1823             CalcApiUsing();
1824         }
1825
1826         private void DisplayApiMaxCount()
1827         {
1828             var limit = MyCommon.TwitterApiInfo.AccessLimit;
1829             if (limit != null)
1830             {
1831                 LabelApiUsing.Text = string.Format(Properties.Resources.SettingAPIUse1, limit.AccessLimitCount - limit.AccessLimitRemain, limit.AccessLimitCount);
1832             }
1833             else
1834             {
1835                 LabelApiUsing.Text = string.Format(Properties.Resources.SettingAPIUse1, "???", "???");
1836             }
1837         }
1838
1839         private void CalcApiUsing()
1840         {
1841             int UsingApi = 0;
1842             int tmp;
1843             int ListsTabNum = 0;
1844             int UserTimelineTabNum = 0;
1845             int ApiLists = 0;
1846             int ApiUserTimeline = 0;
1847
1848             try
1849             {
1850                 // 初回起動時などにnullの場合あり
1851                 ListsTabNum = TabInformations.GetInstance().GetTabsByType(MyCommon.TabUsageType.Lists).Count;
1852             }
1853             catch(Exception)
1854             {
1855                 return;
1856             }
1857
1858             try
1859             {
1860                 // 初回起動時などにnullの場合あり
1861                 UserTimelineTabNum = TabInformations.GetInstance().GetTabsByType(MyCommon.TabUsageType.UserTimeline).Count;
1862             }
1863             catch(Exception)
1864             {
1865                 return;
1866             }
1867
1868             // Recent計算 0は手動更新
1869             if (int.TryParse(TimelinePeriod.Text, out tmp))
1870             {
1871                 if (tmp != 0)
1872                 {
1873                     UsingApi += 3600 / tmp;
1874                 }
1875             }
1876
1877             // Reply計算 0は手動更新
1878             if (int.TryParse(ReplyPeriod.Text, out tmp))
1879             {
1880                 if (tmp != 0)
1881                 {
1882                     UsingApi += 3600 / tmp;
1883                 }
1884             }
1885
1886             // DM計算 0は手動更新 送受信両方
1887             if (int.TryParse(DMPeriod.Text, out tmp))
1888             {
1889                 if (tmp != 0)
1890                 {
1891                     UsingApi += (3600 / tmp) * 2;
1892                 }
1893             }
1894
1895             // Listsタブ計算 0は手動更新
1896             if (int.TryParse(ListsPeriod.Text, out tmp))
1897             {
1898                 if (tmp != 0)
1899                 {
1900                     ApiLists = (3600 / tmp) * ListsTabNum;
1901                     UsingApi += ApiLists;
1902                 }
1903             }
1904
1905             // UserTimelineタブ計算 0は手動更新
1906             if (int.TryParse(UserTimelinePeriod.Text, out tmp))
1907             {
1908                 if (tmp != 0)
1909                 {
1910                     ApiUserTimeline = (3600 / tmp) * UserTimelineTabNum;
1911                     UsingApi += ApiUserTimeline;
1912                 }
1913             }
1914
1915             if (tw != null)
1916             {
1917                 var limit = MyCommon.TwitterApiInfo.AccessLimit;
1918                 if (limit == null)
1919                 {
1920                     if (Twitter.AccountState == MyCommon.ACCOUNT_STATE.Valid)
1921                     {
1922                         Task.Factory.StartNew(() => tw.GetInfoApi10()) //取得エラー時はinfoCountは初期状態(値:-1)
1923                             .ContinueWith(t =>
1924                             {
1925                                 if (this.IsHandleCreated && !this.IsDisposed)
1926                                 {
1927                                     this.DisplayApiMaxCount();
1928                                 }
1929                             }, TaskScheduler.FromCurrentSynchronizationContext());
1930                     }
1931                     else
1932                     {
1933                         LabelApiUsing.Text = string.Format(Properties.Resources.SettingAPIUse1, UsingApi, "???");
1934                     }
1935                 }
1936                 else
1937                 {
1938                     LabelApiUsing.Text = string.Format(Properties.Resources.SettingAPIUse1, UsingApi, limit.AccessLimitCount);
1939                 }
1940             }
1941
1942
1943             LabelPostAndGet.Visible = CheckPostAndGet.Checked && !tw.UserStreamEnabled;
1944             LabelUserStreamActive.Visible = tw.UserStreamEnabled;
1945
1946             LabelApiUsingUserStreamEnabled.Text = string.Format(Properties.Resources.SettingAPIUse2, (ApiLists + ApiUserTimeline).ToString());
1947             LabelApiUsingUserStreamEnabled.Visible = tw.UserStreamEnabled;
1948         }
1949
1950         private void CheckPostAndGet_CheckedChanged(object sender, EventArgs e)
1951         {
1952             CalcApiUsing();
1953         }
1954
1955         private void Setting_Shown(object sender, EventArgs e)
1956         {
1957             do
1958             {
1959                 Thread.Sleep(10);
1960                 if (this.Disposing || this.IsDisposed) return;
1961             } while (!this.IsHandleCreated);
1962             this.TopMost = this.AlwaysTop;
1963             CalcApiUsing();
1964         }
1965
1966         private void ButtonApiCalc_Click(object sender, EventArgs e)
1967         {
1968             CalcApiUsing();
1969         }
1970
1971         public static AppendSettingDialog Instance
1972         {
1973             get { return _instance; }
1974         }
1975
1976         private bool BitlyValidation(string id, string apikey)
1977         {
1978             if (string.IsNullOrEmpty(id) || string.IsNullOrEmpty(apikey))
1979             {
1980                 return false;
1981             }
1982
1983             string req = "http://api.bit.ly/v3/validate";
1984             string content = "";
1985             Dictionary<string, string> param = new Dictionary<string, string>();
1986
1987             param.Add("login", ApplicationSettings.BitlyLoginId);
1988             param.Add("apiKey", ApplicationSettings.BitlyApiKey);
1989             param.Add("x_login", id);
1990             param.Add("x_apiKey", apikey);
1991             param.Add("format", "txt");
1992
1993             if (!(new HttpVarious()).PostData(req, param, out content))
1994             {
1995                 return true;             // 通信エラーの場合はとりあえずチェックを通ったことにする
1996             }
1997             else if (content.Trim() == "1")
1998             {
1999                 return true;             // 検証成功
2000             }
2001             else if (content.Trim() == "0")
2002             {
2003                 return false;            // 検証失敗 APIキーとIDの組み合わせが違う
2004             }
2005             else
2006             {
2007                 return true;             // 規定外応答:通信エラーの可能性があるためとりあえずチェックを通ったことにする
2008             }
2009         }
2010
2011         private void Cancel_Click(object sender, EventArgs e)
2012         {
2013             _ValidationError = false;
2014         }
2015
2016         public bool HotkeyEnabled;
2017         public Keys HotkeyKey;
2018         public int HotkeyValue;
2019         public Keys HotkeyMod;
2020
2021         private void HotkeyText_KeyDown(object sender, KeyEventArgs e)
2022         {
2023             //KeyValueで判定する。
2024             //表示文字とのテーブルを用意すること
2025             HotkeyText.Text = e.KeyCode.ToString();
2026             HotkeyCode.Text = e.KeyValue.ToString();
2027             HotkeyText.Tag = e.KeyCode;
2028             e.Handled = true;
2029             e.SuppressKeyPress = true;
2030         }
2031
2032         private void HotkeyCheck_CheckedChanged(object sender, EventArgs e)
2033         {
2034             HotkeyCtrl.Enabled = HotkeyCheck.Checked;
2035             HotkeyAlt.Enabled = HotkeyCheck.Checked;
2036             HotkeyShift.Enabled = HotkeyCheck.Checked;
2037             HotkeyWin.Enabled = HotkeyCheck.Checked;
2038             HotkeyText.Enabled = HotkeyCheck.Checked;
2039             HotkeyCode.Enabled = HotkeyCheck.Checked;
2040         }
2041
2042         public bool BlinkNewMentions;
2043
2044         private void GetMoreTextCountApi_Validating(object sender, CancelEventArgs e)
2045         {
2046             int cnt;
2047             try
2048             {
2049                 cnt = int.Parse(GetMoreTextCountApi.Text);
2050             }
2051             catch(Exception)
2052             {
2053                 MessageBox.Show(Properties.Resources.TextCountApi_Validating1);
2054                 e.Cancel = true;
2055                 return;
2056             }
2057
2058             if (cnt != 0 && (cnt < 20 || cnt > 200))
2059             {
2060                 MessageBox.Show(Properties.Resources.TextCountApi_Validating1);
2061                 e.Cancel = true;
2062                 return;
2063             }
2064         }
2065
2066         private void UseChangeGetCount_CheckedChanged(object sender, EventArgs e)
2067         {
2068             GetMoreTextCountApi.Enabled = UseChangeGetCount.Checked;
2069             FirstTextCountApi.Enabled = UseChangeGetCount.Checked;
2070             Label28.Enabled = UseChangeGetCount.Checked;
2071             Label30.Enabled = UseChangeGetCount.Checked;
2072             Label53.Enabled = UseChangeGetCount.Checked;
2073             Label66.Enabled = UseChangeGetCount.Checked;
2074             Label17.Enabled = UseChangeGetCount.Checked;
2075             Label25.Enabled = UseChangeGetCount.Checked;
2076             SearchTextCountApi.Enabled = UseChangeGetCount.Checked;
2077             FavoritesTextCountApi.Enabled = UseChangeGetCount.Checked;
2078             UserTimelineTextCountApi.Enabled = UseChangeGetCount.Checked;
2079             ListTextCountApi.Enabled = UseChangeGetCount.Checked;
2080         }
2081
2082         private void FirstTextCountApi_Validating(object sender, CancelEventArgs e)
2083         {
2084             int cnt;
2085             try
2086             {
2087                 cnt = int.Parse(FirstTextCountApi.Text);
2088             }
2089             catch(Exception)
2090             {
2091                 MessageBox.Show(Properties.Resources.TextCountApi_Validating1);
2092                 e.Cancel = true;
2093                 return;
2094             }
2095
2096             if (cnt != 0 && (cnt < 20 || cnt > 200))
2097             {
2098                 MessageBox.Show(Properties.Resources.TextCountApi_Validating1);
2099                 e.Cancel = true;
2100                 return;
2101             }
2102         }
2103
2104         private void SearchTextCountApi_Validating(object sender, CancelEventArgs e)
2105         {
2106             int cnt;
2107             try
2108             {
2109                 cnt = int.Parse(SearchTextCountApi.Text);
2110             }
2111             catch (Exception)
2112             {
2113                 MessageBox.Show(Properties.Resources.TextSearchCountApi_Validating1);
2114                 e.Cancel = true;
2115                 return;
2116             }
2117
2118             if (cnt != 0 && (cnt < 20 || cnt > 100))
2119             {
2120                 MessageBox.Show(Properties.Resources.TextSearchCountApi_Validating1);
2121                 e.Cancel = true;
2122                 return;
2123             }
2124         }
2125
2126         private void FavoritesTextCountApi_Validating(object sender, CancelEventArgs e)
2127         {
2128             int cnt;
2129             try
2130             {
2131                 cnt = int.Parse(FavoritesTextCountApi.Text);
2132             }
2133             catch (Exception)
2134             {
2135                 MessageBox.Show(Properties.Resources.TextCountApi_Validating1);
2136                 e.Cancel = true;
2137                 return;
2138             }
2139
2140             if (cnt != 0 && (cnt < 20 || cnt > 200))
2141             {
2142                 MessageBox.Show(Properties.Resources.TextCountApi_Validating1);
2143                 e.Cancel = true;
2144                 return;
2145             }
2146         }
2147
2148         private void UserTimelineTextCountApi_Validating(object sender, CancelEventArgs e)
2149         {
2150             int cnt;
2151             try
2152             {
2153                 cnt = int.Parse(UserTimelineTextCountApi.Text);
2154             }
2155             catch (Exception)
2156             {
2157                 MessageBox.Show(Properties.Resources.TextCountApi_Validating1);
2158                 e.Cancel = true;
2159                 return;
2160             }
2161
2162             if (cnt != 0 && (cnt < 20 || cnt > 200))
2163             {
2164                 MessageBox.Show(Properties.Resources.TextCountApi_Validating1);
2165                 e.Cancel = true;
2166                 return;
2167             }
2168         }
2169
2170         private void ListTextCountApi_Validating(object sender, CancelEventArgs e)
2171         {
2172             int cnt;
2173             try
2174             {
2175                 cnt = int.Parse(ListTextCountApi.Text);
2176             }
2177             catch (Exception)
2178             {
2179                 MessageBox.Show(Properties.Resources.TextCountApi_Validating1);
2180                 e.Cancel = true;
2181                 return;
2182             }
2183
2184             if (cnt != 0 && (cnt < 20 || cnt > 200))
2185             {
2186                 MessageBox.Show(Properties.Resources.TextCountApi_Validating1);
2187                 e.Cancel = true;
2188                 return;
2189             }
2190         }
2191
2192         //private void CheckEventNotify_CheckedChanged(object sender, EventArgs e)
2193         //                Handles CheckEventNotify.CheckedChanged, CheckFavoritesEvent.CheckStateChanged,
2194         //                        CheckUnfavoritesEvent.CheckStateChanged, CheckFollowEvent.CheckStateChanged,
2195         //                        CheckListMemberAddedEvent.CheckStateChanged, CheckListMemberRemovedEvent.CheckStateChanged,
2196         //                        CheckListCreatedEvent.CheckStateChanged, CheckUserUpdateEvent.CheckStateChanged
2197         //{
2198         //    EventNotifyEnabled = CheckEventNotify.Checked;
2199         //    GetEventNotifyFlag(EventNotifyFlag, IsMyEventNotifyFlag);
2200         //    ApplyEventNotifyFlag(EventNotifyEnabled, EventNotifyFlag, IsMyEventNotifyFlag);
2201         //}
2202
2203         private class EventCheckboxTblElement
2204         {
2205             public CheckBox CheckBox;
2206             public MyCommon.EVENTTYPE Type;
2207         }
2208
2209         private EventCheckboxTblElement[] GetEventCheckboxTable()
2210         {
2211             EventCheckboxTblElement[] _eventCheckboxTable = new EventCheckboxTblElement[8];
2212
2213             _eventCheckboxTable[0] = new EventCheckboxTblElement();
2214             _eventCheckboxTable[0].CheckBox = CheckFavoritesEvent;
2215             _eventCheckboxTable[0].Type = MyCommon.EVENTTYPE.Favorite;
2216
2217             _eventCheckboxTable[1] = new EventCheckboxTblElement();
2218             _eventCheckboxTable[1].CheckBox = CheckUnfavoritesEvent;
2219             _eventCheckboxTable[1].Type = MyCommon.EVENTTYPE.Unfavorite;
2220
2221             _eventCheckboxTable[2] = new EventCheckboxTblElement();
2222             _eventCheckboxTable[2].CheckBox = CheckFollowEvent;
2223             _eventCheckboxTable[2].Type = MyCommon.EVENTTYPE.Follow;
2224
2225             _eventCheckboxTable[3] = new EventCheckboxTblElement();
2226             _eventCheckboxTable[3].CheckBox = CheckListMemberAddedEvent;
2227             _eventCheckboxTable[3].Type = MyCommon.EVENTTYPE.ListMemberAdded;
2228
2229             _eventCheckboxTable[4] = new EventCheckboxTblElement();
2230             _eventCheckboxTable[4].CheckBox = CheckListMemberRemovedEvent;
2231             _eventCheckboxTable[4].Type = MyCommon.EVENTTYPE.ListMemberRemoved;
2232
2233             _eventCheckboxTable[5] = new EventCheckboxTblElement();
2234             _eventCheckboxTable[5].CheckBox = CheckBlockEvent;
2235             _eventCheckboxTable[5].Type = MyCommon.EVENTTYPE.Block;
2236
2237             _eventCheckboxTable[6] = new EventCheckboxTblElement();
2238             _eventCheckboxTable[6].CheckBox = CheckUserUpdateEvent;
2239             _eventCheckboxTable[6].Type = MyCommon.EVENTTYPE.UserUpdate;
2240
2241             _eventCheckboxTable[7] = new EventCheckboxTblElement();
2242             _eventCheckboxTable[7].CheckBox = CheckListCreatedEvent;
2243             _eventCheckboxTable[7].Type = MyCommon.EVENTTYPE.ListCreated;
2244
2245             return _eventCheckboxTable;
2246         }
2247
2248         private void GetEventNotifyFlag(ref MyCommon.EVENTTYPE eventnotifyflag, ref MyCommon.EVENTTYPE isMyeventnotifyflag)
2249         {
2250             MyCommon.EVENTTYPE evt = MyCommon.EVENTTYPE.None;
2251             MyCommon.EVENTTYPE myevt = MyCommon.EVENTTYPE.None;
2252
2253             foreach (EventCheckboxTblElement tbl in GetEventCheckboxTable())
2254             {
2255                 switch (tbl.CheckBox.CheckState)
2256                 {
2257                     case CheckState.Checked:
2258                         evt = evt | tbl.Type;
2259                         myevt = myevt | tbl.Type;
2260                         break;
2261                     case CheckState.Indeterminate:
2262                         evt = evt | tbl.Type;
2263                         break;
2264                     case CheckState.Unchecked:
2265                         break;
2266                 }
2267             }
2268             eventnotifyflag = evt;
2269             isMyeventnotifyflag = myevt;
2270         }
2271
2272         private void ApplyEventNotifyFlag(bool rootEnabled, MyCommon.EVENTTYPE eventnotifyflag, MyCommon.EVENTTYPE isMyeventnotifyflag)
2273         {
2274             MyCommon.EVENTTYPE evt = eventnotifyflag;
2275             MyCommon.EVENTTYPE myevt = isMyeventnotifyflag;
2276
2277             CheckEventNotify.Checked = rootEnabled;
2278
2279             foreach (EventCheckboxTblElement tbl in GetEventCheckboxTable())
2280             {
2281                 if ((evt & tbl.Type) != 0)
2282                 {
2283                     if ((myevt & tbl.Type) != 0)
2284                     {
2285                         tbl.CheckBox.CheckState = CheckState.Checked;
2286                     }
2287                     else
2288                     {
2289                         tbl.CheckBox.CheckState = CheckState.Indeterminate;
2290                     }
2291                 }
2292                 else
2293                 {
2294                     tbl.CheckBox.CheckState = CheckState.Unchecked;
2295                 }
2296                 tbl.CheckBox.Enabled = rootEnabled;
2297             }
2298
2299         }
2300
2301         private void CheckEventNotify_CheckedChanged(object sender, EventArgs e)
2302         {
2303             foreach (EventCheckboxTblElement tbl in GetEventCheckboxTable())
2304             {
2305                 tbl.CheckBox.Enabled = CheckEventNotify.Checked;
2306             }
2307         }
2308
2309         //private void CheckForceEventNotify_CheckedChanged(object sender, EventArgs e)
2310         //{
2311         //    _MyForceEventNotify = CheckEventNotify.Checked;
2312         //}
2313
2314         //private void CheckFavEventUnread_CheckedChanged(object sender, EventArgs e)
2315         //{
2316         //    _MyFavEventUnread = CheckFavEventUnread.Checked;
2317         //}
2318
2319         //private void ComboBoxTranslateLanguage_SelectedIndexChanged(object sender, EventArgs e)
2320         //{
2321         //    _MyTranslateLanguage = (new Google()).GetLanguageEnumFromIndex(ComboBoxTranslateLanguage.SelectedIndex);
2322         //}
2323
2324         private void SoundFileListup()
2325         {
2326             if (EventSoundFile == null) EventSoundFile = "";
2327             ComboBoxEventNotifySound.Items.Clear();
2328             ComboBoxEventNotifySound.Items.Add("");
2329             DirectoryInfo oDir = new DirectoryInfo(Application.StartupPath + Path.DirectorySeparatorChar);
2330             if (Directory.Exists(Path.Combine(Application.StartupPath, "Sounds")))
2331             {
2332                 oDir = oDir.GetDirectories("Sounds")[0];
2333             }
2334             foreach (FileInfo oFile in oDir.GetFiles("*.wav"))
2335             {
2336                 ComboBoxEventNotifySound.Items.Add(oFile.Name);
2337             }
2338             int idx = ComboBoxEventNotifySound.Items.IndexOf(EventSoundFile);
2339             if (idx == -1) idx = 0;
2340             ComboBoxEventNotifySound.SelectedIndex = idx;
2341         }
2342
2343         //private void ComboBoxEventNotifySound_VisibleChanged(object sender, EventArgs e)
2344         //{
2345         //    SoundFileListup();
2346         //}
2347
2348         //private void ComboBoxEventNotifySound_SelectedIndexChanged(object sender, EventArgs e)
2349         //{
2350         //   if (_soundfileListup) return;
2351
2352         //    _MyEventSoundFile = (string)ComboBoxEventNotifySound.SelectedItem;
2353         //}
2354
2355         private void UserAppointUrlText_Validating(object sender, CancelEventArgs e)
2356         {
2357             if (!UserAppointUrlText.Text.StartsWith("http") && !string.IsNullOrEmpty(UserAppointUrlText.Text))
2358             {
2359                 MessageBox.Show("Text Error:正しいURLではありません");
2360             }
2361         }
2362
2363         private void OpenUrl(string url)
2364         {
2365             string myPath = url;
2366             string path = this.BrowserPathText.Text;
2367             try
2368             {
2369                 if (!string.IsNullOrEmpty(BrowserPath))
2370                 {
2371                     if (path.StartsWith("\"") && path.Length > 2 && path.IndexOf("\"", 2) > -1)
2372                     {
2373                         int sep = path.IndexOf("\"", 2);
2374                         string browserPath = path.Substring(1, sep - 1);
2375                         string arg = "";
2376                         if (sep < path.Length - 1)
2377                         {
2378                             arg = path.Substring(sep + 1);
2379                         }
2380                         myPath = arg + " " + myPath;
2381                         System.Diagnostics.Process.Start(browserPath, myPath);
2382                     }
2383                     else
2384                     {
2385                         System.Diagnostics.Process.Start(path, myPath);
2386                     }
2387                 }
2388                 else
2389                 {
2390                     System.Diagnostics.Process.Start(myPath);
2391                 }
2392             }
2393             catch(Exception)
2394             {
2395 //              MessageBox.Show("ブラウザの起動に失敗、またはタイムアウトしました。" + ex.ToString());
2396             }
2397         }
2398
2399         private void CreateAccountButton_Click(object sender, EventArgs e)
2400         {
2401             this.OpenUrl("https://twitter.com/signup");
2402         }
2403
2404         private void CheckAutoConvertUrl_CheckedChanged(object sender, EventArgs e)
2405         {
2406             ShortenTcoCheck.Enabled = CheckAutoConvertUrl.Checked;
2407         }
2408
2409         public AppendSettingDialog()
2410         {
2411             InitializeComponent();
2412
2413             this.Icon = Properties.Resources.MIcon;
2414         }
2415     }
2416 }