1 // OpenTween - Client of Twitter
2 // Copyright (c) 2007-2011 kiri_feather (@kiri_feather) <kiri.feather@gmail.com>
3 // (c) 2008-2011 Moz (@syo68k)
4 // (c) 2008-2011 takeshik (@takeshik) <http://www.takeshik.org/>
5 // (c) 2010-2011 anis774 (@anis774) <http://d.hatena.ne.jp/anis774/>
6 // (c) 2010-2011 fantasticswallow (@f_swallow) <http://twitter.com/f_swallow>
7 // (c) 2011 kim_upsilon (@kim_upsilon) <https://upsilo.net/~upsilon/>
8 // All rights reserved.
10 // This file is part of OpenTween.
12 // This program is free software; you can redistribute it and/or modify it
13 // under the terms of the GNU General Public License as published by the Free
14 // Software Foundation; either version 3 of the License, or (at your option)
17 // This program is distributed in the hope that it will be useful, but
18 // WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
19 // or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License
22 // You should have received a copy of the GNU General Public License along
23 // with this program. If not, see <http://www.gnu.org/licenses/>, or write to
24 // the Free Software Foundation, Inc., 51 Franklin Street - Fifth Floor,
25 // Boston, MA 02110-1301, USA.
28 using System.Collections.Generic;
29 using System.ComponentModel;
34 using System.Windows.Forms;
35 using System.Threading;
37 using System.Resources;
39 using OpenTween.Connection;
40 using OpenTween.Thumbnail;
41 using System.Threading.Tasks;
42 using OpenTween.Setting.Panel;
46 public partial class AppendSettingDialog : OTBaseForm
48 private static AppendSettingDialog _instance = new AppendSettingDialog();
50 private ProxyType _MyProxyType;
52 private bool _ValidationError = false;
53 private MyCommon.EVENTTYPE _MyEventNotifyFlag;
54 private MyCommon.EVENTTYPE _isMyEventNotifyFlag;
55 private string _MyTranslateLanguage;
57 public bool EnableImgAzyobuziNet { get; set; }
58 public bool ImgAzyobuziNetDisabledInDM { get; set; }
59 public MapProvider MapThumbnailProvider;
60 public int MapThumbnailHeight;
61 public int MapThumbnailWidth;
62 public int MapThumbnailZoom;
63 public List<UserAccount> UserAccounts;
64 private long? InitialUserId;
65 public bool IsRemoveSameEvent;
66 public bool IsNotifyUseGrowl;
68 public TwitterConfiguration TwitterConfiguration = TwitterConfiguration.DefaultConfiguration();
72 public event EventHandler<IntervalChangedEventArgs> IntervalChanged;
74 public void LoadConfig(SettingCommon settingCommon, SettingLocal settingLocal)
76 this.GetPeriodPanel.LoadConfig(settingCommon);
77 this.StartupPanel.LoadConfig(settingCommon);
78 this.TweetPrvPanel.LoadConfig(settingCommon);
79 this.TweetActPanel.LoadConfig(settingCommon, settingLocal);
80 this.ActionPanel.LoadConfig(settingCommon, settingLocal);
81 this.FontPanel.LoadConfig(settingLocal);
84 public void SaveConfig(SettingCommon settingCommon, SettingLocal settingLocal)
86 this.GetPeriodPanel.SaveConfig(settingCommon);
87 this.StartupPanel.SaveConfig(settingCommon);
88 this.TweetPrvPanel.SaveConfig(settingCommon);
89 this.TweetActPanel.SaveConfig(settingCommon, settingLocal);
90 this.ActionPanel.SaveConfig(settingCommon, settingLocal);
91 this.FontPanel.SaveConfig(settingLocal);
94 private void TreeViewSetting_BeforeSelect(object sender, TreeViewCancelEventArgs e)
96 if (this.TreeViewSetting.SelectedNode == null) return;
97 var pnl = (SettingPanelBase)this.TreeViewSetting.SelectedNode.Tag;
98 if (pnl == null) return;
103 private void TreeViewSetting_AfterSelect(object sender, TreeViewEventArgs e)
105 if (e.Node == null) return;
106 var pnl = (SettingPanelBase)e.Node.Tag;
107 if (pnl == null) return;
111 if (pnl.Name == "PreviewPanel")
113 if (GrowlHelper.IsDllExists)
115 this.PreviewPanel.IsNotifyUseGrowlCheckBox.Enabled = true;
119 this.PreviewPanel.IsNotifyUseGrowlCheckBox.Enabled = false;
124 private void Save_Click(object sender, EventArgs e)
126 if (MyCommon.IsNetworkAvailable() &&
127 (this.ShortUrlPanel.ComboBoxAutoShortUrlFirst.SelectedIndex == (int)MyCommon.UrlConverter.Bitly || this.ShortUrlPanel.ComboBoxAutoShortUrlFirst.SelectedIndex == (int)MyCommon.UrlConverter.Jmp))
129 // bit.ly 短縮機能実装のプライバシー問題の暫定対応
130 // bit.ly 使用時はログインIDとAPIキーの指定を必須とする
131 // 参照: http://sourceforge.jp/projects/opentween/lists/archive/dev/2012-January/000020.html
132 if (string.IsNullOrEmpty(this.ShortUrlPanel.TextBitlyId.Text) || string.IsNullOrEmpty(this.ShortUrlPanel.TextBitlyPw.Text))
134 MessageBox.Show("bit.ly のログイン名とAPIキーの指定は必須項目です。", Application.ProductName);
135 _ValidationError = true;
136 TreeViewSetting.SelectedNode = TreeViewSetting.Nodes["ConnectionNode"].Nodes["ShortUrlNode"]; // 動作タブを選択
137 TreeViewSetting.Select();
138 this.ShortUrlPanel.TextBitlyId.Focus();
142 if (!BitlyValidation(this.ShortUrlPanel.TextBitlyId.Text, this.ShortUrlPanel.TextBitlyPw.Text))
144 MessageBox.Show(Properties.Resources.SettingSave_ClickText1);
145 _ValidationError = true;
146 TreeViewSetting.SelectedNode = TreeViewSetting.Nodes["ConnectionNode"].Nodes["ShortUrlNode"]; // 動作タブを選択
147 TreeViewSetting.Select();
148 this.ShortUrlPanel.TextBitlyId.Focus();
153 _ValidationError = false;
158 _ValidationError = false;
161 this.UserAccounts.Clear();
162 foreach (object u in this.BasedPanel.AuthUserCombo.Items)
164 this.UserAccounts.Add((UserAccount)u);
166 if (this.BasedPanel.AuthUserCombo.SelectedIndex > -1)
168 foreach (UserAccount u in this.UserAccounts)
170 if (u.Username.ToLower() == ((UserAccount)this.BasedPanel.AuthUserCombo.SelectedItem).Username.ToLower())
172 tw.Initialize(u.Token, u.TokenSecret, u.Username, u.UserId);
175 tw.VerifyCredentials();
176 u.UserId = tw.UserId;
185 tw.Initialize("", "", "", 0);
190 if (this.FollowCheckBox.Checked)
193 HttpConnection.ProxyType ptype;
194 if (RadioProxyNone.Checked)
196 ptype = HttpConnection.ProxyType.None;
198 else if (RadioProxyIE.Checked)
200 ptype = HttpConnection.ProxyType.IE;
204 ptype = HttpConnection.ProxyType.Specified;
206 string padr = TextProxyAddress.Text.Trim();
207 int pport = int.Parse(TextProxyPort.Text.Trim());
208 string pusr = TextProxyUser.Text.Trim();
209 string ppw = TextProxyPassword.Text.Trim();
210 HttpConnection.InitializeConnection(20, ptype, padr, pport, pusr, ppw);
212 string ret = tw.PostFollowCommand(ApplicationSettings.FeedbackTwitterName);
217 ColorSelf = this.FontPanel2.lblSelf.BackColor;
218 ColorAtSelf = this.FontPanel2.lblAtSelf.BackColor;
219 ColorTarget = this.FontPanel2.lblTarget.BackColor;
220 ColorAtTarget = this.FontPanel2.lblAtTarget.BackColor;
221 ColorAtFromTarget = this.FontPanel2.lblAtFromTarget.BackColor;
222 ColorAtTo = this.FontPanel2.lblAtTo.BackColor;
223 ColorInputBackcolor = this.FontPanel2.lblInputBackcolor.BackColor;
224 ColorInputFont = this.FontPanel2.lblInputFont.ForeColor;
225 ColorListBackcolor = this.FontPanel2.lblListBackcolor.BackColor;
226 FontInputFont = this.FontPanel2.lblInputFont.Font;
227 switch (this.PreviewPanel.cmbNameBalloon.SelectedIndex)
230 NameBalloon = MyCommon.NameBalloonEnum.None;
233 NameBalloon = MyCommon.NameBalloonEnum.UserID;
236 NameBalloon = MyCommon.NameBalloonEnum.NickName;
240 CountApi = int.Parse(this.GetCountPanel.TextCountApi.Text);
241 CountApiReply = int.Parse(this.GetCountPanel.TextCountApiReply.Text);
242 DispUsername = this.PreviewPanel.CheckDispUsername.Checked;
243 switch (this.PreviewPanel.ComboDispTitle.SelectedIndex)
246 DispLatestPost = MyCommon.DispTitleEnum.None;
249 DispLatestPost = MyCommon.DispTitleEnum.Ver;
252 DispLatestPost = MyCommon.DispTitleEnum.Post;
255 DispLatestPost = MyCommon.DispTitleEnum.UnreadRepCount;
258 DispLatestPost = MyCommon.DispTitleEnum.UnreadAllCount;
261 DispLatestPost = MyCommon.DispTitleEnum.UnreadAllRepCount;
264 DispLatestPost = MyCommon.DispTitleEnum.UnreadCountAllCount;
266 case 7: //Count of Status/Follow/Follower
267 DispLatestPost = MyCommon.DispTitleEnum.OwnStatus;
270 TinyUrlResolve = this.ShortUrlPanel.CheckTinyURL.Checked;
271 ShortUrl.Instance.DisableExpanding = !TinyUrlResolve;
272 if (this.ProxyPanel.RadioProxyNone.Checked)
274 _MyProxyType = ProxyType.None;
276 else if (this.ProxyPanel.RadioProxyIE.Checked)
278 _MyProxyType = ProxyType.IE;
282 _MyProxyType = ProxyType.Specified;
284 ProxyAddress = this.ProxyPanel.TextProxyAddress.Text.Trim();
285 ProxyPort = int.Parse(this.ProxyPanel.TextProxyPort.Text.Trim());
286 ProxyUser = this.ProxyPanel.TextProxyUser.Text.Trim();
287 ProxyPassword = this.ProxyPanel.TextProxyPassword.Text.Trim();
288 AlwaysTop = this.PreviewPanel.CheckAlwaysTop.Checked;
289 UrlConvertAuto = this.ShortUrlPanel.CheckAutoConvertUrl.Checked;
290 ShortenTco = this.ShortUrlPanel.ShortenTcoCheck.Checked;
292 Nicoms = this.CooperatePanel.CheckNicoms.Checked;
293 DefaultTimeOut = int.Parse(this.ConnectionPanel.ConnectionTimeOut.Text);
294 LimitBalloon = this.PreviewPanel.CheckBalloonLimit.Checked;
295 EventNotifyEnabled = this.NotifyPanel.CheckEventNotify.Checked;
296 GetEventNotifyFlag(ref _MyEventNotifyFlag, ref _isMyEventNotifyFlag);
297 ForceEventNotify = this.NotifyPanel.CheckForceEventNotify.Checked;
298 FavEventUnread = this.NotifyPanel.CheckFavEventUnread.Checked;
299 TranslateLanguage = Bing.GetLanguageEnumFromIndex(this.CooperatePanel.ComboBoxTranslateLanguage.SelectedIndex);
300 EventSoundFile = (string)this.NotifyPanel.ComboBoxEventNotifySound.SelectedItem;
301 AutoShortUrlFirst = (MyCommon.UrlConverter)this.ShortUrlPanel.ComboBoxAutoShortUrlFirst.SelectedIndex;
302 TabIconDisp = this.PreviewPanel.chkTabIconDisp.Checked;
303 IsMonospace = this.PreviewPanel.CheckMonospace.Checked;
304 BitlyUser = this.ShortUrlPanel.TextBitlyId.Text;
305 BitlyPwd = this.ShortUrlPanel.TextBitlyPw.Text;
306 PreviewEnable = this.PreviewPanel.CheckPreviewEnable.Checked;
307 StatusAreaAtBottom = this.PreviewPanel.CheckStatusAreaAtBottom.Checked;
308 TwitterApiUrl = this.ConnectionPanel.TwitterAPIText.Text.Trim();
309 switch (this.PreviewPanel.ReplyIconStateCombo.SelectedIndex)
312 ReplyIconState = MyCommon.REPLY_ICONSTATE.None;
315 ReplyIconState = MyCommon.REPLY_ICONSTATE.StaticIcon;
318 ReplyIconState = MyCommon.REPLY_ICONSTATE.BlinkIcon;
321 switch (this.PreviewPanel.LanguageCombo.SelectedIndex)
339 BlinkNewMentions = this.PreviewPanel.ChkNewMentionsBlink.Checked;
340 UseAdditionalCount = this.GetCountPanel.UseChangeGetCount.Checked;
341 MoreCountApi = int.Parse(this.GetCountPanel.GetMoreTextCountApi.Text);
342 FirstCountApi = int.Parse(this.GetCountPanel.FirstTextCountApi.Text);
343 SearchCountApi = int.Parse(this.GetCountPanel.SearchTextCountApi.Text);
344 FavoritesCountApi = int.Parse(this.GetCountPanel.FavoritesTextCountApi.Text);
345 UserTimelineCountApi = int.Parse(this.GetCountPanel.UserTimelineTextCountApi.Text);
346 ListCountApi = int.Parse(this.GetCountPanel.ListTextCountApi.Text);
347 UserAppointUrl = this.CooperatePanel.UserAppointUrlText.Text;
348 this.EnableImgAzyobuziNet = this.CooperatePanel.EnableImgAzyobuziNetCheckBox.Checked;
349 this.ImgAzyobuziNetDisabledInDM = this.CooperatePanel.ImgAzyobuziNetDisabledInDMCheckBox.Checked;
350 this.MapThumbnailProvider = (MapProvider)this.CooperatePanel.MapThumbnailProviderComboBox.SelectedIndex;
351 this.MapThumbnailHeight = int.Parse(this.CooperatePanel.MapThumbnailHeightTextBox.Text);
352 this.MapThumbnailWidth = int.Parse(this.CooperatePanel.MapThumbnailWidthTextBox.Text);
353 this.MapThumbnailZoom = int.Parse(this.CooperatePanel.MapThumbnailZoomTextBox.Text);
354 this.IsRemoveSameEvent = this.NotifyPanel.IsRemoveSameFavEventCheckBox.Checked;
355 this.IsNotifyUseGrowl = this.PreviewPanel.IsNotifyUseGrowlCheckBox.Checked;
359 MessageBox.Show(Properties.Resources.Save_ClickText3);
360 this.DialogResult = DialogResult.Cancel;
365 private void Setting_FormClosing(object sender, FormClosingEventArgs e)
367 if (MyCommon._endingFlag) return;
369 if (this.DialogResult == DialogResult.Cancel)
371 //キャンセル時は画面表示時のアカウントに戻す
372 //キャンセル時でも認証済みアカウント情報は保存する
373 this.UserAccounts.Clear();
374 foreach (object u in this.BasedPanel.AuthUserCombo.Items)
376 this.UserAccounts.Add((UserAccount)u);
378 //アクティブユーザーを起動時のアカウントに戻す(起動時アカウントなければ何もしない)
379 bool userSet = false;
380 if (this.InitialUserId != null)
382 foreach (UserAccount u in this.UserAccounts)
384 if (u.UserId == this.InitialUserId)
386 tw.Initialize(u.Token, u.TokenSecret, u.Username, u.UserId);
392 //認証済みアカウントが削除されていた場合、もしくは起動時アカウントがなかった場合は、
397 tw.Initialize("", "", "", 0);
401 if (tw != null && string.IsNullOrEmpty(tw.Username) && e.CloseReason == CloseReason.None)
403 if (MessageBox.Show(Properties.Resources.Setting_FormClosing1, "Confirm", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.Cancel)
408 if (_ValidationError)
412 if (e.Cancel == false && TreeViewSetting.SelectedNode != null)
414 var curPanel = (SettingPanelBase)TreeViewSetting.SelectedNode.Tag;
415 curPanel.Visible = false;
416 curPanel.Enabled = false;
420 private void Setting_Load(object sender, EventArgs e)
422 tw = ((TweenMain)this.Owner).TwitterInstance;
423 //this.AuthStateLabel.Enabled = true;
424 //this.AuthUserLabel.Enabled = true;
425 this.BasedPanel.AuthClearButton.Enabled = true;
427 //if (tw.Username == "")
429 // //this.AuthStateLabel.Text = Properties.Resources.AuthorizeButton_Click4
430 // //this.AuthUserLabel.Text = ""
431 // //this.Save.Enabled = false
435 // //this.AuthStateLabel.Text = Properties.Resources.AuthorizeButton_Click3;
436 // //if (TwitterApiInfo.AccessLevel == ApiAccessLevel.ReadWrite)
438 // // this.AuthStateLabel.Text += "(xAuth)";
440 // //else if (TwitterApiInfo.AccessLevel == ApiAccessLevel.ReadWriteAndDirectMessage)
442 // // this.AuthStateLabel.Text += "(OAuth)";
444 // //this.AuthUserLabel.Text = tw.Username;
447 this.BasedPanel.AuthUserCombo.Items.Clear();
448 if (this.UserAccounts.Count > 0)
450 this.BasedPanel.AuthUserCombo.Items.AddRange(this.UserAccounts.ToArray());
451 foreach (UserAccount u in this.UserAccounts)
453 if (u.UserId == tw.UserId)
455 this.BasedPanel.AuthUserCombo.SelectedItem = u;
456 this.InitialUserId = u.UserId;
462 this.FontPanel2.lblSelf.BackColor = ColorSelf;
463 this.FontPanel2.lblAtSelf.BackColor = ColorAtSelf;
464 this.FontPanel2.lblTarget.BackColor = ColorTarget;
465 this.FontPanel2.lblAtTarget.BackColor = ColorAtTarget;
466 this.FontPanel2.lblAtFromTarget.BackColor = ColorAtFromTarget;
467 this.FontPanel2.lblAtTo.BackColor = ColorAtTo;
468 this.FontPanel2.lblInputBackcolor.BackColor = ColorInputBackcolor;
469 this.FontPanel2.lblInputFont.ForeColor = ColorInputFont;
470 this.FontPanel2.lblInputFont.Font = FontInputFont;
471 this.FontPanel2.lblListBackcolor.BackColor = ColorListBackcolor;
475 case MyCommon.NameBalloonEnum.None:
476 this.PreviewPanel.cmbNameBalloon.SelectedIndex = 0;
478 case MyCommon.NameBalloonEnum.UserID:
479 this.PreviewPanel.cmbNameBalloon.SelectedIndex = 1;
481 case MyCommon.NameBalloonEnum.NickName:
482 this.PreviewPanel.cmbNameBalloon.SelectedIndex = 2;
486 this.GetCountPanel.TextCountApi.Text = CountApi.ToString();
487 this.GetCountPanel.TextCountApiReply.Text = CountApiReply.ToString();
488 this.PreviewPanel.CheckDispUsername.Checked = DispUsername;
489 switch (DispLatestPost)
491 case MyCommon.DispTitleEnum.None:
492 this.PreviewPanel.ComboDispTitle.SelectedIndex = 0;
494 case MyCommon.DispTitleEnum.Ver:
495 this.PreviewPanel.ComboDispTitle.SelectedIndex = 1;
497 case MyCommon.DispTitleEnum.Post:
498 this.PreviewPanel.ComboDispTitle.SelectedIndex = 2;
500 case MyCommon.DispTitleEnum.UnreadRepCount:
501 this.PreviewPanel.ComboDispTitle.SelectedIndex = 3;
503 case MyCommon.DispTitleEnum.UnreadAllCount:
504 this.PreviewPanel.ComboDispTitle.SelectedIndex = 4;
506 case MyCommon.DispTitleEnum.UnreadAllRepCount:
507 this.PreviewPanel.ComboDispTitle.SelectedIndex = 5;
509 case MyCommon.DispTitleEnum.UnreadCountAllCount:
510 this.PreviewPanel.ComboDispTitle.SelectedIndex = 6;
512 case MyCommon.DispTitleEnum.OwnStatus:
513 this.PreviewPanel.ComboDispTitle.SelectedIndex = 7;
516 this.ShortUrlPanel.CheckTinyURL.Checked = TinyUrlResolve;
517 switch (_MyProxyType)
520 this.ProxyPanel.RadioProxyNone.Checked = true;
523 this.ProxyPanel.RadioProxyIE.Checked = true;
526 this.ProxyPanel.RadioProxySpecified.Checked = true;
529 bool chk = this.ProxyPanel.RadioProxySpecified.Checked;
530 this.ProxyPanel.LabelProxyAddress.Enabled = chk;
531 this.ProxyPanel.TextProxyAddress.Enabled = chk;
532 this.ProxyPanel.LabelProxyPort.Enabled = chk;
533 this.ProxyPanel.TextProxyPort.Enabled = chk;
534 this.ProxyPanel.LabelProxyUser.Enabled = chk;
535 this.ProxyPanel.TextProxyUser.Enabled = chk;
536 this.ProxyPanel.LabelProxyPassword.Enabled = chk;
537 this.ProxyPanel.TextProxyPassword.Enabled = chk;
539 this.ProxyPanel.TextProxyAddress.Text = ProxyAddress;
540 this.ProxyPanel.TextProxyPort.Text = ProxyPort.ToString();
541 this.ProxyPanel.TextProxyUser.Text = ProxyUser;
542 this.ProxyPanel.TextProxyPassword.Text = ProxyPassword;
544 this.PreviewPanel.CheckAlwaysTop.Checked = AlwaysTop;
545 this.ShortUrlPanel.CheckAutoConvertUrl.Checked = UrlConvertAuto;
546 this.ShortUrlPanel.ShortenTcoCheck.Checked = ShortenTco;
547 this.ShortUrlPanel.ShortenTcoCheck.Enabled = this.ShortUrlPanel.CheckAutoConvertUrl.Checked;
549 this.CooperatePanel.CheckNicoms.Checked = Nicoms;
550 this.ConnectionPanel.ConnectionTimeOut.Text = DefaultTimeOut.ToString();
551 this.PreviewPanel.CheckBalloonLimit.Checked = LimitBalloon;
553 ApplyEventNotifyFlag(EventNotifyEnabled, EventNotifyFlag, IsMyEventNotifyFlag);
554 this.NotifyPanel.CheckForceEventNotify.Checked = ForceEventNotify;
555 this.NotifyPanel.CheckFavEventUnread.Checked = FavEventUnread;
556 this.CooperatePanel.ComboBoxTranslateLanguage.SelectedIndex = Bing.GetIndexFromLanguageEnum(TranslateLanguage);
558 this.ShortUrlPanel.ComboBoxAutoShortUrlFirst.SelectedIndex = (int)AutoShortUrlFirst;
559 this.PreviewPanel.chkTabIconDisp.Checked = TabIconDisp;
560 this.PreviewPanel.CheckMonospace.Checked = IsMonospace;
561 this.ShortUrlPanel.TextBitlyId.Text = BitlyUser;
562 this.ShortUrlPanel.TextBitlyPw.Text = BitlyPwd;
563 this.ShortUrlPanel.TextBitlyId.Modified = false;
564 this.ShortUrlPanel.TextBitlyPw.Modified = false;
565 this.PreviewPanel.CheckPreviewEnable.Checked = PreviewEnable;
566 this.PreviewPanel.CheckStatusAreaAtBottom.Checked = StatusAreaAtBottom;
567 this.ConnectionPanel.TwitterAPIText.Text = TwitterApiUrl;
568 switch (ReplyIconState)
570 case MyCommon.REPLY_ICONSTATE.None:
571 this.PreviewPanel.ReplyIconStateCombo.SelectedIndex = 0;
573 case MyCommon.REPLY_ICONSTATE.StaticIcon:
574 this.PreviewPanel.ReplyIconStateCombo.SelectedIndex = 1;
576 case MyCommon.REPLY_ICONSTATE.BlinkIcon:
577 this.PreviewPanel.ReplyIconStateCombo.SelectedIndex = 2;
583 this.PreviewPanel.LanguageCombo.SelectedIndex = 0;
586 this.PreviewPanel.LanguageCombo.SelectedIndex = 1;
589 this.PreviewPanel.LanguageCombo.SelectedIndex = 2;
592 this.PreviewPanel.LanguageCombo.SelectedIndex = 3;
595 this.PreviewPanel.LanguageCombo.SelectedIndex = 0;
598 this.PreviewPanel.ChkNewMentionsBlink.Checked = BlinkNewMentions;
600 this.GetCountPanel.GetMoreTextCountApi.Text = MoreCountApi.ToString();
601 this.GetCountPanel.FirstTextCountApi.Text = FirstCountApi.ToString();
602 this.GetCountPanel.SearchTextCountApi.Text = SearchCountApi.ToString();
603 this.GetCountPanel.FavoritesTextCountApi.Text = FavoritesCountApi.ToString();
604 this.GetCountPanel.UserTimelineTextCountApi.Text = UserTimelineCountApi.ToString();
605 this.GetCountPanel.ListTextCountApi.Text = ListCountApi.ToString();
606 this.GetCountPanel.UseChangeGetCount.Checked = UseAdditionalCount;
607 this.GetCountPanel.Label28.Enabled = this.GetCountPanel.UseChangeGetCount.Checked;
608 this.GetCountPanel.Label30.Enabled = this.GetCountPanel.UseChangeGetCount.Checked;
609 this.GetCountPanel.Label53.Enabled = this.GetCountPanel.UseChangeGetCount.Checked;
610 this.GetCountPanel.Label66.Enabled = this.GetCountPanel.UseChangeGetCount.Checked;
611 this.GetCountPanel.Label17.Enabled = this.GetCountPanel.UseChangeGetCount.Checked;
612 this.GetCountPanel.Label25.Enabled = this.GetCountPanel.UseChangeGetCount.Checked;
613 this.GetCountPanel.GetMoreTextCountApi.Enabled = this.GetCountPanel.UseChangeGetCount.Checked;
614 this.GetCountPanel.FirstTextCountApi.Enabled = this.GetCountPanel.UseChangeGetCount.Checked;
615 this.GetCountPanel.SearchTextCountApi.Enabled = this.GetCountPanel.UseChangeGetCount.Checked;
616 this.GetCountPanel.FavoritesTextCountApi.Enabled = this.GetCountPanel.UseChangeGetCount.Checked;
617 this.GetCountPanel.UserTimelineTextCountApi.Enabled = this.GetCountPanel.UseChangeGetCount.Checked;
618 this.GetCountPanel.ListTextCountApi.Enabled = this.GetCountPanel.UseChangeGetCount.Checked;
619 this.CooperatePanel.UserAppointUrlText.Text = UserAppointUrl;
620 this.CooperatePanel.EnableImgAzyobuziNetCheckBox.Checked = this.EnableImgAzyobuziNet;
621 this.CooperatePanel.ImgAzyobuziNetDisabledInDMCheckBox.Checked = this.ImgAzyobuziNetDisabledInDM;
622 this.CooperatePanel.MapThumbnailProviderComboBox.SelectedIndex = (int)this.MapThumbnailProvider;
623 this.CooperatePanel.MapThumbnailHeightTextBox.Text = this.MapThumbnailHeight.ToString();
624 this.CooperatePanel.MapThumbnailWidthTextBox.Text = this.MapThumbnailWidth.ToString();
625 this.CooperatePanel.MapThumbnailZoomTextBox.Text = this.MapThumbnailZoom.ToString();
626 this.NotifyPanel.IsRemoveSameFavEventCheckBox.Checked = this.IsRemoveSameEvent;
627 this.PreviewPanel.IsNotifyUseGrowlCheckBox.Checked = this.IsNotifyUseGrowl;
629 if (GrowlHelper.IsDllExists)
631 this.PreviewPanel.IsNotifyUseGrowlCheckBox.Enabled = true;
635 this.PreviewPanel.IsNotifyUseGrowlCheckBox.Enabled = false;
638 this.TreeViewSetting.Nodes["BasedNode"].Tag = BasedPanel;
639 this.TreeViewSetting.Nodes["BasedNode"].Nodes["PeriodNode"].Tag = GetPeriodPanel;
640 this.TreeViewSetting.Nodes["BasedNode"].Nodes["StartUpNode"].Tag = StartupPanel;
641 this.TreeViewSetting.Nodes["BasedNode"].Nodes["GetCountNode"].Tag = GetCountPanel;
642 //this.TreeViewSetting.Nodes["BasedNode"].Nodes["UserStreamNode"].Tag = UserStreamPanel;
643 this.TreeViewSetting.Nodes["ActionNode"].Tag = ActionPanel;
644 this.TreeViewSetting.Nodes["ActionNode"].Nodes["TweetActNode"].Tag = TweetActPanel;
645 this.TreeViewSetting.Nodes["PreviewNode"].Tag = PreviewPanel;
646 this.TreeViewSetting.Nodes["PreviewNode"].Nodes["TweetPrvNode"].Tag = TweetPrvPanel;
647 this.TreeViewSetting.Nodes["PreviewNode"].Nodes["NotifyNode"].Tag = NotifyPanel;
648 this.TreeViewSetting.Nodes["FontNode"].Tag = FontPanel;
649 this.TreeViewSetting.Nodes["FontNode"].Nodes["FontNode2"].Tag = FontPanel2;
650 this.TreeViewSetting.Nodes["ConnectionNode"].Tag = ConnectionPanel;
651 this.TreeViewSetting.Nodes["ConnectionNode"].Nodes["ProxyNode"].Tag = ProxyPanel;
652 this.TreeViewSetting.Nodes["ConnectionNode"].Nodes["CooperateNode"].Tag = CooperatePanel;
653 this.TreeViewSetting.Nodes["ConnectionNode"].Nodes["ShortUrlNode"].Tag = ShortUrlPanel;
655 this.TreeViewSetting.SelectedNode = this.TreeViewSetting.Nodes[0];
656 this.TreeViewSetting.ExpandAll();
658 //TreeViewSetting.SelectedNode = TreeViewSetting.TopNode;
659 ActiveControl = BasedPanel.StartAuthButton;
662 private void UReadMng_CheckedChanged(object sender, EventArgs e)
664 if (this.ActionPanel.UReadMng.Checked == true)
666 this.StartupPanel.StartupReaded.Enabled = true;
670 this.StartupPanel.StartupReaded.Enabled = false;
674 private void btnFontAndColor_Click(object sender, EventArgs e) // Handles btnUnread.Click, btnDetail.Click, btnListFont.Click, btnInputFont.Click
676 Button Btn = (Button) sender;
679 FontDialog1.AllowVerticalFonts = false;
680 FontDialog1.AllowScriptChange = true;
681 FontDialog1.AllowSimulations = true;
682 FontDialog1.AllowVectorFonts = true;
683 FontDialog1.FixedPitchOnly = false;
684 FontDialog1.FontMustExist = true;
685 FontDialog1.ScriptsOnly = false;
686 FontDialog1.ShowApply = false;
687 FontDialog1.ShowEffects = true;
688 FontDialog1.ShowColor = true;
693 FontDialog1.Color = this.FontPanel.lblUnread.ForeColor;
694 FontDialog1.Font = this.FontPanel.lblUnread.Font;
697 FontDialog1.Color = this.FontPanel.lblDetail.ForeColor;
698 FontDialog1.Font = this.FontPanel.lblDetail.Font;
701 FontDialog1.Color = this.FontPanel.lblListFont.ForeColor;
702 FontDialog1.Font = this.FontPanel.lblListFont.Font;
705 FontDialog1.Color = this.FontPanel2.lblInputFont.ForeColor;
706 FontDialog1.Font = this.FontPanel2.lblInputFont.Font;
712 rtn = FontDialog1.ShowDialog();
714 catch(ArgumentException ex)
716 MessageBox.Show(ex.Message);
720 if (rtn == DialogResult.Cancel) return;
725 this.FontPanel.lblUnread.ForeColor = FontDialog1.Color;
726 this.FontPanel.lblUnread.Font = FontDialog1.Font;
729 this.FontPanel.lblDetail.ForeColor = FontDialog1.Color;
730 this.FontPanel.lblDetail.Font = FontDialog1.Font;
733 this.FontPanel.lblListFont.ForeColor = FontDialog1.Color;
734 this.FontPanel.lblListFont.Font = FontDialog1.Font;
737 this.FontPanel2.lblInputFont.ForeColor = FontDialog1.Color;
738 this.FontPanel2.lblInputFont.Font = FontDialog1.Font;
744 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
746 Button Btn = (Button)sender;
749 ColorDialog1.AllowFullOpen = true;
750 ColorDialog1.AnyColor = true;
751 ColorDialog1.FullOpen = false;
752 ColorDialog1.SolidColorOnly = false;
757 ColorDialog1.Color = this.FontPanel2.lblSelf.BackColor;
760 ColorDialog1.Color = this.FontPanel2.lblAtSelf.BackColor;
763 ColorDialog1.Color = this.FontPanel2.lblTarget.BackColor;
766 ColorDialog1.Color = this.FontPanel2.lblAtTarget.BackColor;
768 case "btnAtFromTarget":
769 ColorDialog1.Color = this.FontPanel2.lblAtFromTarget.BackColor;
772 ColorDialog1.Color = this.FontPanel.lblFav.ForeColor;
775 ColorDialog1.Color = this.FontPanel.lblOWL.ForeColor;
778 ColorDialog1.Color = this.FontPanel.lblRetweet.ForeColor;
780 case "btnInputBackcolor":
781 ColorDialog1.Color = this.FontPanel2.lblInputBackcolor.BackColor;
784 ColorDialog1.Color = this.FontPanel2.lblAtTo.BackColor;
787 ColorDialog1.Color = this.FontPanel2.lblListBackcolor.BackColor;
789 case "btnDetailBack":
790 ColorDialog1.Color = this.FontPanel.lblDetailBackcolor.BackColor;
792 case "btnDetailLink":
793 ColorDialog1.Color = this.FontPanel.lblDetailLink.ForeColor;
797 rtn = ColorDialog1.ShowDialog();
799 if (rtn == DialogResult.Cancel) return;
804 this.FontPanel2.lblSelf.BackColor = ColorDialog1.Color;
807 this.FontPanel2.lblAtSelf.BackColor = ColorDialog1.Color;
810 this.FontPanel2.lblTarget.BackColor = ColorDialog1.Color;
813 this.FontPanel2.lblAtTarget.BackColor = ColorDialog1.Color;
815 case "btnAtFromTarget":
816 this.FontPanel2.lblAtFromTarget.BackColor = ColorDialog1.Color;
819 this.FontPanel.lblFav.ForeColor = ColorDialog1.Color;
822 this.FontPanel.lblOWL.ForeColor = ColorDialog1.Color;
825 this.FontPanel.lblRetweet.ForeColor = ColorDialog1.Color;
827 case "btnInputBackcolor":
828 this.FontPanel2.lblInputBackcolor.BackColor = ColorDialog1.Color;
831 this.FontPanel2.lblAtTo.BackColor = ColorDialog1.Color;
834 this.FontPanel2.lblListBackcolor.BackColor = ColorDialog1.Color;
836 case "btnDetailBack":
837 this.FontPanel.lblDetailBackcolor.BackColor = ColorDialog1.Color;
839 case "btnDetailLink":
840 this.FontPanel.lblDetailLink.ForeColor = ColorDialog1.Color;
845 public Color ColorSelf { get; set; }
846 public Color ColorAtSelf { get; set; }
847 public Color ColorTarget { get; set; }
848 public Color ColorAtTarget { get; set; }
849 public Color ColorAtFromTarget { get; set; }
850 public Color ColorAtTo { get; set; }
851 public Color ColorInputBackcolor { get; set; }
852 public Color ColorInputFont { get; set; }
853 public Font FontInputFont { get; set; }
854 public Color ColorListBackcolor { get; set; }
855 public MyCommon.NameBalloonEnum NameBalloon { get; set; }
856 public int CountApi { get; set; }
857 public int CountApiReply { get; set; }
858 public int MoreCountApi { get; set; }
859 public int FirstCountApi { get; set; }
860 public int SearchCountApi { get; set; }
861 public int FavoritesCountApi { get; set; }
862 public int UserTimelineCountApi { get; set; }
863 public int ListCountApi { get; set; }
864 public string RecommendStatusText { get; set; }
865 public bool DispUsername { get; set; }
866 public MyCommon.DispTitleEnum DispLatestPost { get; set; }
867 public bool TinyUrlResolve { get; set; }
869 public ProxyType SelectedProxyType
875 _MyProxyType = value;
879 public string ProxyAddress { get; set; }
880 public int ProxyPort { get; set; }
881 public string ProxyUser { get; set; }
882 public string ProxyPassword { get; set; }
883 public bool AlwaysTop { get; set; }
884 public bool UrlConvertAuto { get; set; }
885 public bool ShortenTco { get; set; }
886 public bool Nicoms { get; set; }
887 public MyCommon.UrlConverter AutoShortUrlFirst { get; set; }
888 public int DefaultTimeOut { get; set; }
889 public bool TabIconDisp { get; set; }
890 public MyCommon.REPLY_ICONSTATE ReplyIconState { get; set; }
891 public bool IsMonospace { get; set; }
892 public string BitlyUser { get; set; }
893 public string BitlyPwd { get; set; }
894 public bool PreviewEnable { get; set; }
895 public bool StatusAreaAtBottom { get; set; }
896 public bool UseAdditionalCount { get; set; }
897 public string TwitterApiUrl { get; set; }
898 public string Language { get; set; }
900 public bool LimitBalloon { get; set; }
901 public bool EventNotifyEnabled { get; set; }
903 public MyCommon.EVENTTYPE EventNotifyFlag
907 return _MyEventNotifyFlag;
911 _MyEventNotifyFlag = value;
915 public MyCommon.EVENTTYPE IsMyEventNotifyFlag
919 return _isMyEventNotifyFlag;
923 _isMyEventNotifyFlag = value;
927 public bool ForceEventNotify { get; set; }
928 public bool FavEventUnread { get; set; }
930 public string TranslateLanguage
934 return _MyTranslateLanguage;
938 _MyTranslateLanguage = value;
939 this.CooperatePanel.ComboBoxTranslateLanguage.SelectedIndex = Bing.GetIndexFromLanguageEnum(value);
943 public string EventSoundFile { get; set; }
944 public string UserAppointUrl { get; set; }
946 private bool StartAuth()
950 if (this.ProxyPanel.RadioProxyNone.Checked)
952 ptype = ProxyType.None;
954 else if (this.ProxyPanel.RadioProxyIE.Checked)
956 ptype = ProxyType.IE;
960 ptype = ProxyType.Specified;
962 string padr = this.ProxyPanel.TextProxyAddress.Text.Trim();
963 int pport = int.Parse(this.ProxyPanel.TextProxyPort.Text.Trim());
964 string pusr = this.ProxyPanel.TextProxyUser.Text.Trim();
965 string ppw = this.ProxyPanel.TextProxyPassword.Text.Trim();
968 Networking.DefaultTimeout = TimeSpan.FromSeconds(20);
969 Networking.SetWebProxy(ptype, padr, pport, pusr, ppw);
970 HttpTwitter.TwitterUrl = this.ConnectionPanel.TwitterAPIText.Text.Trim();
971 tw.Initialize("", "", "", 0);
972 //this.AuthStateLabel.Text = Properties.Resources.AuthorizeButton_Click4;
973 //this.AuthUserLabel.Text = "";
974 string pinPageUrl = "";
975 string rslt = tw.StartAuthentication(ref pinPageUrl);
976 if (string.IsNullOrEmpty(rslt))
978 string pin = AuthDialog.DoAuth(this, pinPageUrl);
979 if (!string.IsNullOrEmpty(pin))
991 MessageBox.Show(Properties.Resources.AuthorizeButton_Click2 + Environment.NewLine + rslt, "Authenticate", MessageBoxButtons.OK);
996 private bool PinAuth()
998 string pin = this._pin; //PIN Code
1000 string rslt = tw.Authenticate(pin);
1001 if (string.IsNullOrEmpty(rslt))
1003 MessageBox.Show(Properties.Resources.AuthorizeButton_Click1, "Authenticate", MessageBoxButtons.OK);
1004 //this.AuthStateLabel.Text = Properties.Resources.AuthorizeButton_Click3;
1005 //this.AuthUserLabel.Text = tw.Username;
1007 UserAccount user = new UserAccount();
1008 user.Username = tw.Username;
1009 user.UserId = tw.UserId;
1010 user.Token = tw.AccessToken;
1011 user.TokenSecret = tw.AccessTokenSecret;
1013 foreach (object u in this.BasedPanel.AuthUserCombo.Items)
1015 if (((UserAccount)u).Username.ToLower() == tw.Username.ToLower())
1017 idx = this.BasedPanel.AuthUserCombo.Items.IndexOf(u);
1023 this.BasedPanel.AuthUserCombo.Items.RemoveAt(idx);
1024 this.BasedPanel.AuthUserCombo.Items.Insert(idx, user);
1025 this.BasedPanel.AuthUserCombo.SelectedIndex = idx;
1029 this.BasedPanel.AuthUserCombo.SelectedIndex = this.BasedPanel.AuthUserCombo.Items.Add(user);
1031 //if (TwitterApiInfo.AccessLevel = ApiAccessLevel.ReadWrite)
1033 // this.AuthStateLabel.Text += "(xAuth)";
1035 //else if (TwitterApiInfo.AccessLevel == ApiAccessLevel.ReadWriteAndDirectMessage)
1037 // this.AuthStateLabel.Text += "(OAuth)";
1043 MessageBox.Show(Properties.Resources.AuthorizeButton_Click2 + Environment.NewLine + rslt, "Authenticate", MessageBoxButtons.OK);
1044 //this.AuthStateLabel.Text = Properties.Resources.AuthorizeButton_Click4;
1045 //this.AuthUserLabel.Text = "";
1050 private void StartAuthButton_Click(object sender, EventArgs e)
1052 //this.Save.Enabled = false;
1057 //this.Save.Enabled = true;
1062 private void CheckPostAndGet_CheckedChanged(object sender, EventArgs e)
1064 this.GetPeriodPanel.LabelPostAndGet.Visible = this.GetPeriodPanel.CheckPostAndGet.Checked && !tw.UserStreamEnabled;
1067 private void Setting_Shown(object sender, EventArgs e)
1072 if (this.Disposing || this.IsDisposed) return;
1073 } while (!this.IsHandleCreated);
1074 this.TopMost = this.AlwaysTop;
1076 this.GetPeriodPanel.LabelPostAndGet.Visible = this.GetPeriodPanel.CheckPostAndGet.Checked && !tw.UserStreamEnabled;
1077 this.GetPeriodPanel.LabelUserStreamActive.Visible = tw.UserStreamEnabled;
1080 public static AppendSettingDialog Instance
1082 get { return _instance; }
1085 private bool BitlyValidation(string id, string apikey)
1087 if (string.IsNullOrEmpty(id) || string.IsNullOrEmpty(apikey))
1092 string req = "http://api.bit.ly/v3/validate";
1093 string content = "";
1094 Dictionary<string, string> param = new Dictionary<string, string>();
1096 param.Add("login", ApplicationSettings.BitlyLoginId);
1097 param.Add("apiKey", ApplicationSettings.BitlyApiKey);
1098 param.Add("x_login", id);
1099 param.Add("x_apiKey", apikey);
1100 param.Add("format", "txt");
1102 if (!(new HttpVarious()).PostData(req, param, out content))
1104 return true; // 通信エラーの場合はとりあえずチェックを通ったことにする
1106 else if (content.Trim() == "1")
1108 return true; // 検証成功
1110 else if (content.Trim() == "0")
1112 return false; // 検証失敗 APIキーとIDの組み合わせが違う
1116 return true; // 規定外応答:通信エラーの可能性があるためとりあえずチェックを通ったことにする
1120 private void Cancel_Click(object sender, EventArgs e)
1122 _ValidationError = false;
1125 public bool BlinkNewMentions;
1127 //private void CheckEventNotify_CheckedChanged(object sender, EventArgs e)
1128 // Handles CheckEventNotify.CheckedChanged, CheckFavoritesEvent.CheckStateChanged,
1129 // CheckUnfavoritesEvent.CheckStateChanged, CheckFollowEvent.CheckStateChanged,
1130 // CheckListMemberAddedEvent.CheckStateChanged, CheckListMemberRemovedEvent.CheckStateChanged,
1131 // CheckListCreatedEvent.CheckStateChanged, CheckUserUpdateEvent.CheckStateChanged
1133 // EventNotifyEnabled = CheckEventNotify.Checked;
1134 // GetEventNotifyFlag(EventNotifyFlag, IsMyEventNotifyFlag);
1135 // ApplyEventNotifyFlag(EventNotifyEnabled, EventNotifyFlag, IsMyEventNotifyFlag);
1138 private class EventCheckboxTblElement
1140 public CheckBox CheckBox;
1141 public MyCommon.EVENTTYPE Type;
1144 private EventCheckboxTblElement[] GetEventCheckboxTable()
1146 EventCheckboxTblElement[] _eventCheckboxTable = new EventCheckboxTblElement[8];
1148 _eventCheckboxTable[0] = new EventCheckboxTblElement();
1149 _eventCheckboxTable[0].CheckBox = this.NotifyPanel.CheckFavoritesEvent;
1150 _eventCheckboxTable[0].Type = MyCommon.EVENTTYPE.Favorite;
1152 _eventCheckboxTable[1] = new EventCheckboxTblElement();
1153 _eventCheckboxTable[1].CheckBox = this.NotifyPanel.CheckUnfavoritesEvent;
1154 _eventCheckboxTable[1].Type = MyCommon.EVENTTYPE.Unfavorite;
1156 _eventCheckboxTable[2] = new EventCheckboxTblElement();
1157 _eventCheckboxTable[2].CheckBox = this.NotifyPanel.CheckFollowEvent;
1158 _eventCheckboxTable[2].Type = MyCommon.EVENTTYPE.Follow;
1160 _eventCheckboxTable[3] = new EventCheckboxTblElement();
1161 _eventCheckboxTable[3].CheckBox = this.NotifyPanel.CheckListMemberAddedEvent;
1162 _eventCheckboxTable[3].Type = MyCommon.EVENTTYPE.ListMemberAdded;
1164 _eventCheckboxTable[4] = new EventCheckboxTblElement();
1165 _eventCheckboxTable[4].CheckBox = this.NotifyPanel.CheckListMemberRemovedEvent;
1166 _eventCheckboxTable[4].Type = MyCommon.EVENTTYPE.ListMemberRemoved;
1168 _eventCheckboxTable[5] = new EventCheckboxTblElement();
1169 _eventCheckboxTable[5].CheckBox = this.NotifyPanel.CheckBlockEvent;
1170 _eventCheckboxTable[5].Type = MyCommon.EVENTTYPE.Block;
1172 _eventCheckboxTable[6] = new EventCheckboxTblElement();
1173 _eventCheckboxTable[6].CheckBox = this.NotifyPanel.CheckUserUpdateEvent;
1174 _eventCheckboxTable[6].Type = MyCommon.EVENTTYPE.UserUpdate;
1176 _eventCheckboxTable[7] = new EventCheckboxTblElement();
1177 _eventCheckboxTable[7].CheckBox = this.NotifyPanel.CheckListCreatedEvent;
1178 _eventCheckboxTable[7].Type = MyCommon.EVENTTYPE.ListCreated;
1180 return _eventCheckboxTable;
1183 private void GetEventNotifyFlag(ref MyCommon.EVENTTYPE eventnotifyflag, ref MyCommon.EVENTTYPE isMyeventnotifyflag)
1185 MyCommon.EVENTTYPE evt = MyCommon.EVENTTYPE.None;
1186 MyCommon.EVENTTYPE myevt = MyCommon.EVENTTYPE.None;
1188 foreach (EventCheckboxTblElement tbl in GetEventCheckboxTable())
1190 switch (tbl.CheckBox.CheckState)
1192 case CheckState.Checked:
1193 evt = evt | tbl.Type;
1194 myevt = myevt | tbl.Type;
1196 case CheckState.Indeterminate:
1197 evt = evt | tbl.Type;
1199 case CheckState.Unchecked:
1203 eventnotifyflag = evt;
1204 isMyeventnotifyflag = myevt;
1207 private void ApplyEventNotifyFlag(bool rootEnabled, MyCommon.EVENTTYPE eventnotifyflag, MyCommon.EVENTTYPE isMyeventnotifyflag)
1209 MyCommon.EVENTTYPE evt = eventnotifyflag;
1210 MyCommon.EVENTTYPE myevt = isMyeventnotifyflag;
1212 this.NotifyPanel.CheckEventNotify.Checked = rootEnabled;
1214 foreach (EventCheckboxTblElement tbl in GetEventCheckboxTable())
1216 if ((evt & tbl.Type) != 0)
1218 if ((myevt & tbl.Type) != 0)
1220 tbl.CheckBox.CheckState = CheckState.Checked;
1224 tbl.CheckBox.CheckState = CheckState.Indeterminate;
1229 tbl.CheckBox.CheckState = CheckState.Unchecked;
1231 tbl.CheckBox.Enabled = rootEnabled;
1236 private void CheckEventNotify_CheckedChanged(object sender, EventArgs e)
1238 foreach (EventCheckboxTblElement tbl in GetEventCheckboxTable())
1240 tbl.CheckBox.Enabled = this.NotifyPanel.CheckEventNotify.Checked;
1244 //private void CheckForceEventNotify_CheckedChanged(object sender, EventArgs e)
1246 // _MyForceEventNotify = CheckEventNotify.Checked;
1249 //private void CheckFavEventUnread_CheckedChanged(object sender, EventArgs e)
1251 // _MyFavEventUnread = CheckFavEventUnread.Checked;
1254 //private void ComboBoxTranslateLanguage_SelectedIndexChanged(object sender, EventArgs e)
1256 // _MyTranslateLanguage = (new Google()).GetLanguageEnumFromIndex(ComboBoxTranslateLanguage.SelectedIndex);
1259 private void SoundFileListup()
1261 if (EventSoundFile == null) EventSoundFile = "";
1262 this.NotifyPanel.ComboBoxEventNotifySound.Items.Clear();
1263 this.NotifyPanel.ComboBoxEventNotifySound.Items.Add("");
1264 DirectoryInfo oDir = new DirectoryInfo(Application.StartupPath + Path.DirectorySeparatorChar);
1265 if (Directory.Exists(Path.Combine(Application.StartupPath, "Sounds")))
1267 oDir = oDir.GetDirectories("Sounds")[0];
1269 foreach (FileInfo oFile in oDir.GetFiles("*.wav"))
1271 this.NotifyPanel.ComboBoxEventNotifySound.Items.Add(oFile.Name);
1273 int idx = this.NotifyPanel.ComboBoxEventNotifySound.Items.IndexOf(EventSoundFile);
1274 if (idx == -1) idx = 0;
1275 this.NotifyPanel.ComboBoxEventNotifySound.SelectedIndex = idx;
1278 //private void ComboBoxEventNotifySound_VisibleChanged(object sender, EventArgs e)
1280 // SoundFileListup();
1283 //private void ComboBoxEventNotifySound_SelectedIndexChanged(object sender, EventArgs e)
1285 // if (_soundfileListup) return;
1287 // _MyEventSoundFile = (string)ComboBoxEventNotifySound.SelectedItem;
1290 private void OpenUrl(string url)
1292 string myPath = url;
1293 string path = this.ActionPanel.BrowserPathText.Text;
1296 if (!string.IsNullOrEmpty(path))
1298 if (path.StartsWith("\"") && path.Length > 2 && path.IndexOf("\"", 2) > -1)
1300 int sep = path.IndexOf("\"", 2);
1301 string browserPath = path.Substring(1, sep - 1);
1303 if (sep < path.Length - 1)
1305 arg = path.Substring(sep + 1);
1307 myPath = arg + " " + myPath;
1308 System.Diagnostics.Process.Start(browserPath, myPath);
1312 System.Diagnostics.Process.Start(path, myPath);
1317 System.Diagnostics.Process.Start(myPath);
1322 // MessageBox.Show("ブラウザの起動に失敗、またはタイムアウトしました。" + ex.ToString());
1326 private void CreateAccountButton_Click(object sender, EventArgs e)
1328 this.OpenUrl("https://twitter.com/signup");
1331 public AppendSettingDialog()
1333 InitializeComponent();
1335 this.BasedPanel.StartAuthButton.Click += this.StartAuthButton_Click;
1336 this.BasedPanel.CreateAccountButton.Click += this.CreateAccountButton_Click;
1337 this.NotifyPanel.CheckEventNotify.CheckedChanged += this.CheckEventNotify_CheckedChanged;
1338 this.GetPeriodPanel.CheckPostAndGet.CheckedChanged += this.CheckPostAndGet_CheckedChanged;
1339 this.ActionPanel.UReadMng.CheckedChanged += this.UReadMng_CheckedChanged;
1340 this.FontPanel.btnUnread.Click += this.btnFontAndColor_Click;
1341 this.FontPanel.btnDetail.Click += this.btnFontAndColor_Click;
1342 this.FontPanel.btnListFont.Click += this.btnFontAndColor_Click;
1343 this.FontPanel.btnFav.Click += this.btnColor_Click;
1344 this.FontPanel.btnOWL.Click += this.btnColor_Click;
1345 this.FontPanel.btnRetweet.Click += this.btnColor_Click;
1346 this.FontPanel.btnDetailBack.Click += this.btnColor_Click;
1347 this.FontPanel.btnDetailLink.Click += this.btnColor_Click;
1348 this.FontPanel2.btnInputFont.Click += this.btnFontAndColor_Click;
1349 this.FontPanel2.btnSelf.Click += this.btnColor_Click;
1350 this.FontPanel2.btnAtSelf.Click += this.btnColor_Click;
1351 this.FontPanel2.btnTarget.Click += this.btnColor_Click;
1352 this.FontPanel2.btnAtTarget.Click += this.btnColor_Click;
1353 this.FontPanel2.btnAtFromTarget.Click += this.btnColor_Click;
1354 this.FontPanel2.btnInputBackcolor.Click += this.btnColor_Click;
1355 this.FontPanel2.btnAtTo.Click += this.btnColor_Click;
1356 this.FontPanel2.btnListBack.Click += this.btnColor_Click;
1358 this.Icon = Properties.Resources.MIcon;
1361 private void GetPeriodPanel_IntervalChanged(object sender, IntervalChangedEventArgs e)
1363 if (this.IntervalChanged != null)
1364 this.IntervalChanged(sender, e);
1368 public class IntervalChangedEventArgs : EventArgs
1370 public bool UserStream;
1371 public bool Timeline;
1373 public bool DirectMessage;
1374 public bool PublicSearch;
1376 public bool UserTimeline;