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;
38 using OpenTween.Thumbnail;
39 using System.Threading.Tasks;
40 using OpenTween.Setting.Panel;
44 public partial class AppendSettingDialog : OTBaseForm
46 private static AppendSettingDialog _instance = new AppendSettingDialog();
48 private HttpConnection.ProxyType _MyProxyType;
50 private bool _ValidationError = false;
51 private MyCommon.EVENTTYPE _MyEventNotifyFlag;
52 private MyCommon.EVENTTYPE _isMyEventNotifyFlag;
53 private string _MyTranslateLanguage;
55 public bool HideDuplicatedRetweets;
57 public bool IsPreviewFoursquare;
58 public MapProvider MapThumbnailProvider;
59 public int MapThumbnailHeight;
60 public int MapThumbnailWidth;
61 public int MapThumbnailZoom;
62 public bool IsListStatusesIncludeRts;
63 public List<UserAccount> UserAccounts;
64 private long? InitialUserId;
65 public bool TabMouseLock;
66 public bool IsRemoveSameEvent;
67 public bool IsNotifyUseGrowl;
69 public TwitterDataModel.Configuration TwitterConfiguration = new TwitterDataModel.Configuration();
73 public class IntervalChangedEventArgs : EventArgs
75 public bool UserStream;
78 public bool DirectMessage;
79 public bool PublicSearch;
81 public bool UserTimeline;
84 public delegate void IntervalChangedEventHandler(object sender, IntervalChangedEventArgs e);
85 public event IntervalChangedEventHandler IntervalChanged;
87 private void TreeViewSetting_BeforeSelect(object sender, TreeViewCancelEventArgs e)
89 if (this.TreeViewSetting.SelectedNode == null) return;
90 var pnl = (SettingPanelBase)this.TreeViewSetting.SelectedNode.Tag;
91 if (pnl == null) return;
96 private void TreeViewSetting_AfterSelect(object sender, TreeViewEventArgs e)
98 if (e.Node == null) return;
99 var pnl = (SettingPanelBase)e.Node.Tag;
100 if (pnl == null) return;
104 if (pnl.Name == "PreviewPanel")
106 if (GrowlHelper.IsDllExists)
108 this.PreviewPanel.IsNotifyUseGrowlCheckBox.Enabled = true;
112 this.PreviewPanel.IsNotifyUseGrowlCheckBox.Enabled = false;
117 private void Save_Click(object sender, EventArgs e)
119 if (MyCommon.IsNetworkAvailable() &&
120 (this.ShortUrlPanel.ComboBoxAutoShortUrlFirst.SelectedIndex == (int)MyCommon.UrlConverter.Bitly || this.ShortUrlPanel.ComboBoxAutoShortUrlFirst.SelectedIndex == (int)MyCommon.UrlConverter.Jmp))
122 // bit.ly 短縮機能実装のプライバシー問題の暫定対応
123 // bit.ly 使用時はログインIDとAPIキーの指定を必須とする
124 // 参照: http://sourceforge.jp/projects/opentween/lists/archive/dev/2012-January/000020.html
125 if (string.IsNullOrEmpty(this.ShortUrlPanel.TextBitlyId.Text) || string.IsNullOrEmpty(this.ShortUrlPanel.TextBitlyPw.Text))
127 MessageBox.Show("bit.ly のログイン名とAPIキーの指定は必須項目です。", Application.ProductName);
128 _ValidationError = true;
129 TreeViewSetting.SelectedNode = TreeViewSetting.Nodes["ConnectionNode"].Nodes["ShortUrlNode"]; // 動作タブを選択
130 TreeViewSetting.Select();
131 this.ShortUrlPanel.TextBitlyId.Focus();
135 if (!BitlyValidation(this.ShortUrlPanel.TextBitlyId.Text, this.ShortUrlPanel.TextBitlyPw.Text))
137 MessageBox.Show(Properties.Resources.SettingSave_ClickText1);
138 _ValidationError = true;
139 TreeViewSetting.SelectedNode = TreeViewSetting.Nodes["ConnectionNode"].Nodes["ShortUrlNode"]; // 動作タブを選択
140 TreeViewSetting.Select();
141 this.ShortUrlPanel.TextBitlyId.Focus();
146 _ValidationError = false;
151 _ValidationError = false;
154 this.UserAccounts.Clear();
155 foreach (object u in this.BasedPanel.AuthUserCombo.Items)
157 this.UserAccounts.Add((UserAccount)u);
159 if (this.BasedPanel.AuthUserCombo.SelectedIndex > -1)
161 foreach (UserAccount u in this.UserAccounts)
163 if (u.Username.ToLower() == ((UserAccount)this.BasedPanel.AuthUserCombo.SelectedItem).Username.ToLower())
165 tw.Initialize(u.Token, u.TokenSecret, u.Username, u.UserId);
168 tw.VerifyCredentials();
169 u.UserId = tw.UserId;
178 tw.Initialize("", "", "", 0);
183 if (this.FollowCheckBox.Checked)
186 HttpConnection.ProxyType ptype;
187 if (RadioProxyNone.Checked)
189 ptype = HttpConnection.ProxyType.None;
191 else if (RadioProxyIE.Checked)
193 ptype = HttpConnection.ProxyType.IE;
197 ptype = HttpConnection.ProxyType.Specified;
199 string padr = TextProxyAddress.Text.Trim();
200 int pport = int.Parse(TextProxyPort.Text.Trim());
201 string pusr = TextProxyUser.Text.Trim();
202 string ppw = TextProxyPassword.Text.Trim();
203 HttpConnection.InitializeConnection(20, ptype, padr, pport, pusr, ppw);
205 string ret = tw.PostFollowCommand(ApplicationSettings.FeedbackTwitterName);
208 IntervalChangedEventArgs arg = new IntervalChangedEventArgs();
209 bool isIntervalChanged = false;
213 UserstreamStartup = this.GetPeriodPanel.StartupUserstreamCheck.Checked;
215 if (UserstreamPeriodInt != int.Parse(this.GetPeriodPanel.UserstreamPeriod.Text))
217 UserstreamPeriodInt = int.Parse(this.GetPeriodPanel.UserstreamPeriod.Text);
218 arg.UserStream = true;
219 isIntervalChanged = true;
221 if (TimelinePeriodInt != int.Parse(this.GetPeriodPanel.TimelinePeriod.Text))
223 TimelinePeriodInt = int.Parse(this.GetPeriodPanel.TimelinePeriod.Text);
225 isIntervalChanged = true;
227 if (DMPeriodInt != int.Parse(this.GetPeriodPanel.DMPeriod.Text))
229 DMPeriodInt = int.Parse(this.GetPeriodPanel.DMPeriod.Text);
230 arg.DirectMessage = true;
231 isIntervalChanged = true;
233 if (PubSearchPeriodInt != int.Parse(this.GetPeriodPanel.PubSearchPeriod.Text))
235 PubSearchPeriodInt = int.Parse(this.GetPeriodPanel.PubSearchPeriod.Text);
236 arg.PublicSearch = true;
237 isIntervalChanged = true;
240 if (ListsPeriodInt != int.Parse(this.GetPeriodPanel.ListsPeriod.Text))
242 ListsPeriodInt = int.Parse(this.GetPeriodPanel.ListsPeriod.Text);
244 isIntervalChanged = true;
246 if (ReplyPeriodInt != int.Parse(this.GetPeriodPanel.ReplyPeriod.Text))
248 ReplyPeriodInt = int.Parse(this.GetPeriodPanel.ReplyPeriod.Text);
250 isIntervalChanged = true;
252 if (UserTimelinePeriodInt != int.Parse(this.GetPeriodPanel.UserTimelinePeriod.Text))
254 UserTimelinePeriodInt = int.Parse(this.GetPeriodPanel.UserTimelinePeriod.Text);
255 arg.UserTimeline = true;
256 isIntervalChanged = true;
259 if (isIntervalChanged && IntervalChanged != null)
261 IntervalChanged(this, arg);
264 Readed = this.StartupPanel.StartupReaded.Checked;
265 switch (this.TweetPrvPanel.IconSize.SelectedIndex)
268 IconSz = MyCommon.IconSizes.IconNone;
271 IconSz = MyCommon.IconSizes.Icon16;
274 IconSz = MyCommon.IconSizes.Icon24;
277 IconSz = MyCommon.IconSizes.Icon48;
280 IconSz = MyCommon.IconSizes.Icon48_2;
283 Status = this.TweetActPanel.StatusText.Text;
284 PlaySound = this.ActionPanel.PlaySnd.Checked;
285 UnreadManage = this.ActionPanel.UReadMng.Checked;
286 OneWayLove = this.TweetPrvPanel.OneWayLv.Checked;
288 FontUnread = this.FontPanel.lblUnread.Font; //未使用
289 ColorUnread = this.FontPanel.lblUnread.ForeColor;
290 FontReaded = this.FontPanel.lblListFont.Font; //リストフォントとして使用
291 ColorReaded = this.FontPanel.lblListFont.ForeColor;
292 ColorFav = this.FontPanel.lblFav.ForeColor;
293 ColorOWL = this.FontPanel.lblOWL.ForeColor;
294 ColorRetweet = this.FontPanel.lblRetweet.ForeColor;
295 FontDetail = this.FontPanel.lblDetail.Font;
296 ColorSelf = this.FontPanel2.lblSelf.BackColor;
297 ColorAtSelf = this.FontPanel2.lblAtSelf.BackColor;
298 ColorTarget = this.FontPanel2.lblTarget.BackColor;
299 ColorAtTarget = this.FontPanel2.lblAtTarget.BackColor;
300 ColorAtFromTarget = this.FontPanel2.lblAtFromTarget.BackColor;
301 ColorAtTo = this.FontPanel2.lblAtTo.BackColor;
302 ColorInputBackcolor = this.FontPanel2.lblInputBackcolor.BackColor;
303 ColorInputFont = this.FontPanel2.lblInputFont.ForeColor;
304 ColorListBackcolor = this.FontPanel2.lblListBackcolor.BackColor;
305 ColorDetailBackcolor = this.FontPanel.lblDetailBackcolor.BackColor;
306 ColorDetail = this.FontPanel.lblDetail.ForeColor;
307 ColorDetailLink = this.FontPanel.lblDetailLink.ForeColor;
308 FontInputFont = this.FontPanel2.lblInputFont.Font;
309 switch (this.PreviewPanel.cmbNameBalloon.SelectedIndex)
312 NameBalloon = MyCommon.NameBalloonEnum.None;
315 NameBalloon = MyCommon.NameBalloonEnum.UserID;
318 NameBalloon = MyCommon.NameBalloonEnum.NickName;
322 switch (this.TweetActPanel.ComboBoxPostKeySelect.SelectedIndex)
325 PostShiftEnter = true;
326 PostCtrlEnter = false;
329 PostCtrlEnter = true;
330 PostShiftEnter = false;
333 PostCtrlEnter = false;
334 PostShiftEnter = false;
337 CountApi = int.Parse(this.GetCountPanel.TextCountApi.Text);
338 CountApiReply = int.Parse(this.GetCountPanel.TextCountApiReply.Text);
339 BrowserPath = this.ActionPanel.BrowserPathText.Text.Trim();
340 PostAndGet = this.GetPeriodPanel.CheckPostAndGet.Checked;
341 UseRecommendStatus = this.TweetActPanel.CheckUseRecommendStatus.Checked;
342 DispUsername = this.PreviewPanel.CheckDispUsername.Checked;
343 CloseToExit = this.ActionPanel.CheckCloseToExit.Checked;
344 MinimizeToTray = this.ActionPanel.CheckMinimizeToTray.Checked;
345 switch (this.PreviewPanel.ComboDispTitle.SelectedIndex)
348 DispLatestPost = MyCommon.DispTitleEnum.None;
351 DispLatestPost = MyCommon.DispTitleEnum.Ver;
354 DispLatestPost = MyCommon.DispTitleEnum.Post;
357 DispLatestPost = MyCommon.DispTitleEnum.UnreadRepCount;
360 DispLatestPost = MyCommon.DispTitleEnum.UnreadAllCount;
363 DispLatestPost = MyCommon.DispTitleEnum.UnreadAllRepCount;
366 DispLatestPost = MyCommon.DispTitleEnum.UnreadCountAllCount;
368 case 7: //Count of Status/Follow/Follower
369 DispLatestPost = MyCommon.DispTitleEnum.OwnStatus;
372 SortOrderLock = this.TweetPrvPanel.CheckSortOrderLock.Checked;
373 ViewTabBottom = this.TweetPrvPanel.CheckViewTabBottom.Checked;
374 TinyUrlResolve = this.ShortUrlPanel.CheckTinyURL.Checked;
375 ShortUrl.Instance.DisableExpanding = !TinyUrlResolve;
376 if (this.ProxyPanel.RadioProxyNone.Checked)
378 _MyProxyType = HttpConnection.ProxyType.None;
380 else if (this.ProxyPanel.RadioProxyIE.Checked)
382 _MyProxyType = HttpConnection.ProxyType.IE;
386 _MyProxyType = HttpConnection.ProxyType.Specified;
388 ProxyAddress = this.ProxyPanel.TextProxyAddress.Text.Trim();
389 ProxyPort = int.Parse(this.ProxyPanel.TextProxyPort.Text.Trim());
390 ProxyUser = this.ProxyPanel.TextProxyUser.Text.Trim();
391 ProxyPassword = this.ProxyPanel.TextProxyPassword.Text.Trim();
392 StartupVersion = this.StartupPanel.CheckStartupVersion.Checked;
393 StartupFollowers = this.StartupPanel.CheckStartupFollowers.Checked;
394 RestrictFavCheck = this.ActionPanel.CheckFavRestrict.Checked;
395 AlwaysTop = this.PreviewPanel.CheckAlwaysTop.Checked;
396 UrlConvertAuto = this.ShortUrlPanel.CheckAutoConvertUrl.Checked;
397 ShortenTco = this.ShortUrlPanel.ShortenTcoCheck.Checked;
399 Nicoms = this.CooperatePanel.CheckNicoms.Checked;
400 UseUnreadStyle = this.TweetPrvPanel.chkUnreadStyle.Checked;
401 DateTimeFormat = this.TweetPrvPanel.CmbDateTimeFormat.Text;
402 DefaultTimeOut = int.Parse(this.ConnectionPanel.ConnectionTimeOut.Text);
403 RetweetNoConfirm = this.TweetActPanel.CheckRetweetNoConfirm.Checked;
404 LimitBalloon = this.PreviewPanel.CheckBalloonLimit.Checked;
405 EventNotifyEnabled = this.NotifyPanel.CheckEventNotify.Checked;
406 GetEventNotifyFlag(ref _MyEventNotifyFlag, ref _isMyEventNotifyFlag);
407 ForceEventNotify = this.NotifyPanel.CheckForceEventNotify.Checked;
408 FavEventUnread = this.NotifyPanel.CheckFavEventUnread.Checked;
409 TranslateLanguage = (new Bing()).GetLanguageEnumFromIndex(this.CooperatePanel.ComboBoxTranslateLanguage.SelectedIndex);
410 EventSoundFile = (string)this.NotifyPanel.ComboBoxEventNotifySound.SelectedItem;
411 AutoShortUrlFirst = (MyCommon.UrlConverter)this.ShortUrlPanel.ComboBoxAutoShortUrlFirst.SelectedIndex;
412 TabIconDisp = this.PreviewPanel.chkTabIconDisp.Checked;
413 ReadOwnPost = this.ActionPanel.chkReadOwnPost.Checked;
414 GetFav = this.StartupPanel.chkGetFav.Checked;
415 IsMonospace = this.PreviewPanel.CheckMonospace.Checked;
416 ReadOldPosts = this.ActionPanel.CheckReadOldPosts.Checked;
417 BitlyUser = this.ShortUrlPanel.TextBitlyId.Text;
418 BitlyPwd = this.ShortUrlPanel.TextBitlyPw.Text;
419 ShowGrid = this.TweetPrvPanel.CheckShowGrid.Checked;
420 UseAtIdSupplement = this.TweetActPanel.CheckAtIdSupple.Checked;
421 UseHashSupplement = this.TweetActPanel.CheckHashSupple.Checked;
422 PreviewEnable = this.PreviewPanel.CheckPreviewEnable.Checked;
423 TwitterApiUrl = this.ConnectionPanel.TwitterAPIText.Text.Trim();
424 switch (this.PreviewPanel.ReplyIconStateCombo.SelectedIndex)
427 ReplyIconState = MyCommon.REPLY_ICONSTATE.None;
430 ReplyIconState = MyCommon.REPLY_ICONSTATE.StaticIcon;
433 ReplyIconState = MyCommon.REPLY_ICONSTATE.BlinkIcon;
436 switch (this.PreviewPanel.LanguageCombo.SelectedIndex)
454 HotkeyEnabled = this.ActionPanel.HotkeyCheck.Checked;
455 HotkeyMod = Keys.None;
456 if (this.ActionPanel.HotkeyAlt.Checked) HotkeyMod = HotkeyMod | Keys.Alt;
457 if (this.ActionPanel.HotkeyShift.Checked) HotkeyMod = HotkeyMod | Keys.Shift;
458 if (this.ActionPanel.HotkeyCtrl.Checked) HotkeyMod = HotkeyMod | Keys.Control;
459 if (this.ActionPanel.HotkeyWin.Checked) HotkeyMod = HotkeyMod | Keys.LWin;
460 int.TryParse(this.ActionPanel.HotkeyCode.Text, out HotkeyValue);
461 HotkeyKey = (Keys)this.ActionPanel.HotkeyText.Tag;
462 BlinkNewMentions = this.PreviewPanel.ChkNewMentionsBlink.Checked;
463 UseAdditionalCount = this.GetCountPanel.UseChangeGetCount.Checked;
464 MoreCountApi = int.Parse(this.GetCountPanel.GetMoreTextCountApi.Text);
465 FirstCountApi = int.Parse(this.GetCountPanel.FirstTextCountApi.Text);
466 SearchCountApi = int.Parse(this.GetCountPanel.SearchTextCountApi.Text);
467 FavoritesCountApi = int.Parse(this.GetCountPanel.FavoritesTextCountApi.Text);
468 UserTimelineCountApi = int.Parse(this.GetCountPanel.UserTimelineTextCountApi.Text);
469 ListCountApi = int.Parse(this.GetCountPanel.ListTextCountApi.Text);
470 OpenUserTimeline = this.ActionPanel.CheckOpenUserTimeline.Checked;
471 ListDoubleClickAction = this.ActionPanel.ListDoubleClickActionComboBox.SelectedIndex;
472 UserAppointUrl = this.CooperatePanel.UserAppointUrlText.Text;
473 this.HideDuplicatedRetweets = this.TweetPrvPanel.HideDuplicatedRetweetsCheck.Checked;
474 this.IsPreviewFoursquare = this.CooperatePanel.IsPreviewFoursquareCheckBox.Checked;
475 this.MapThumbnailProvider = (MapProvider)this.CooperatePanel.MapThumbnailProviderComboBox.SelectedIndex;
476 this.MapThumbnailHeight = int.Parse(this.CooperatePanel.MapThumbnailHeightTextBox.Text);
477 this.MapThumbnailWidth = int.Parse(this.CooperatePanel.MapThumbnailWidthTextBox.Text);
478 this.MapThumbnailZoom = int.Parse(this.CooperatePanel.MapThumbnailZoomTextBox.Text);
479 this.IsListStatusesIncludeRts = this.TweetPrvPanel.IsListsIncludeRtsCheckBox.Checked;
480 this.TabMouseLock = this.ActionPanel.TabMouseLockCheck.Checked;
481 this.IsRemoveSameEvent = this.NotifyPanel.IsRemoveSameFavEventCheckBox.Checked;
482 this.IsNotifyUseGrowl = this.PreviewPanel.IsNotifyUseGrowlCheckBox.Checked;
486 MessageBox.Show(Properties.Resources.Save_ClickText3);
487 this.DialogResult = DialogResult.Cancel;
492 private void Setting_FormClosing(object sender, FormClosingEventArgs e)
494 if (MyCommon._endingFlag) return;
496 if (this.DialogResult == DialogResult.Cancel)
498 //キャンセル時は画面表示時のアカウントに戻す
499 //キャンセル時でも認証済みアカウント情報は保存する
500 this.UserAccounts.Clear();
501 foreach (object u in this.BasedPanel.AuthUserCombo.Items)
503 this.UserAccounts.Add((UserAccount)u);
505 //アクティブユーザーを起動時のアカウントに戻す(起動時アカウントなければ何もしない)
506 bool userSet = false;
507 if (this.InitialUserId != null)
509 foreach (UserAccount u in this.UserAccounts)
511 if (u.UserId == this.InitialUserId)
513 tw.Initialize(u.Token, u.TokenSecret, u.Username, u.UserId);
519 //認証済みアカウントが削除されていた場合、もしくは起動時アカウントがなかった場合は、
524 tw.Initialize("", "", "", 0);
528 if (tw != null && string.IsNullOrEmpty(tw.Username) && e.CloseReason == CloseReason.None)
530 if (MessageBox.Show(Properties.Resources.Setting_FormClosing1, "Confirm", MessageBoxButtons.OKCancel, MessageBoxIcon.Question) == DialogResult.Cancel)
535 if (_ValidationError)
539 if (e.Cancel == false && TreeViewSetting.SelectedNode != null)
541 var curPanel = (SettingPanelBase)TreeViewSetting.SelectedNode.Tag;
542 curPanel.Visible = false;
543 curPanel.Enabled = false;
547 private void Setting_Load(object sender, EventArgs e)
549 tw = ((TweenMain)this.Owner).TwitterInstance;
550 string uname = tw.Username;
551 string pw = tw.Password;
552 string tk = tw.AccessToken;
553 string tks = tw.AccessTokenSecret;
554 //this.AuthStateLabel.Enabled = true;
555 //this.AuthUserLabel.Enabled = true;
556 this.BasedPanel.AuthClearButton.Enabled = true;
558 //if (tw.Username == "")
560 // //this.AuthStateLabel.Text = Properties.Resources.AuthorizeButton_Click4
561 // //this.AuthUserLabel.Text = ""
562 // //this.Save.Enabled = false
566 // //this.AuthStateLabel.Text = Properties.Resources.AuthorizeButton_Click3;
567 // //if (TwitterApiInfo.AccessLevel == ApiAccessLevel.ReadWrite)
569 // // this.AuthStateLabel.Text += "(xAuth)";
571 // //else if (TwitterApiInfo.AccessLevel == ApiAccessLevel.ReadWriteAndDirectMessage)
573 // // this.AuthStateLabel.Text += "(OAuth)";
575 // //this.AuthUserLabel.Text = tw.Username;
578 this.BasedPanel.AuthUserCombo.Items.Clear();
579 if (this.UserAccounts.Count > 0)
581 this.BasedPanel.AuthUserCombo.Items.AddRange(this.UserAccounts.ToArray());
582 foreach (UserAccount u in this.UserAccounts)
584 if (u.UserId == tw.UserId)
586 this.BasedPanel.AuthUserCombo.SelectedItem = u;
587 this.InitialUserId = u.UserId;
593 this.GetPeriodPanel.StartupUserstreamCheck.Checked = UserstreamStartup;
594 this.GetPeriodPanel.UserstreamPeriod.Text = UserstreamPeriodInt.ToString();
595 this.GetPeriodPanel.TimelinePeriod.Text = TimelinePeriodInt.ToString();
596 this.GetPeriodPanel.ReplyPeriod.Text = ReplyPeriodInt.ToString();
597 this.GetPeriodPanel.DMPeriod.Text = DMPeriodInt.ToString();
598 this.GetPeriodPanel.PubSearchPeriod.Text = PubSearchPeriodInt.ToString();
599 this.GetPeriodPanel.ListsPeriod.Text = ListsPeriodInt.ToString();
600 this.GetPeriodPanel.UserTimelinePeriod.Text = UserTimelinePeriodInt.ToString();
602 this.StartupPanel.StartupReaded.Checked = Readed;
605 case MyCommon.IconSizes.IconNone:
606 this.TweetPrvPanel.IconSize.SelectedIndex = 0;
608 case MyCommon.IconSizes.Icon16:
609 this.TweetPrvPanel.IconSize.SelectedIndex = 1;
611 case MyCommon.IconSizes.Icon24:
612 this.TweetPrvPanel.IconSize.SelectedIndex = 2;
614 case MyCommon.IconSizes.Icon48:
615 this.TweetPrvPanel.IconSize.SelectedIndex = 3;
617 case MyCommon.IconSizes.Icon48_2:
618 this.TweetPrvPanel.IconSize.SelectedIndex = 4;
621 this.TweetActPanel.StatusText.Text = Status;
622 this.ActionPanel.UReadMng.Checked = UnreadManage;
623 if (UnreadManage == false)
625 this.StartupPanel.StartupReaded.Enabled = false;
629 this.StartupPanel.StartupReaded.Enabled = true;
631 this.ActionPanel.PlaySnd.Checked = PlaySound;
632 this.TweetPrvPanel.OneWayLv.Checked = OneWayLove;
634 this.FontPanel.lblListFont.Font = FontReaded;
635 this.FontPanel.lblUnread.Font = FontUnread;
636 this.FontPanel.lblUnread.ForeColor = ColorUnread;
637 this.FontPanel.lblListFont.ForeColor = ColorReaded;
638 this.FontPanel.lblFav.ForeColor = ColorFav;
639 this.FontPanel.lblOWL.ForeColor = ColorOWL;
640 this.FontPanel.lblRetweet.ForeColor = ColorRetweet;
641 this.FontPanel.lblDetail.Font = FontDetail;
642 this.FontPanel2.lblSelf.BackColor = ColorSelf;
643 this.FontPanel2.lblAtSelf.BackColor = ColorAtSelf;
644 this.FontPanel2.lblTarget.BackColor = ColorTarget;
645 this.FontPanel2.lblAtTarget.BackColor = ColorAtTarget;
646 this.FontPanel2.lblAtFromTarget.BackColor = ColorAtFromTarget;
647 this.FontPanel2.lblAtTo.BackColor = ColorAtTo;
648 this.FontPanel2.lblInputBackcolor.BackColor = ColorInputBackcolor;
649 this.FontPanel2.lblInputFont.ForeColor = ColorInputFont;
650 this.FontPanel2.lblInputFont.Font = FontInputFont;
651 this.FontPanel2.lblListBackcolor.BackColor = ColorListBackcolor;
652 this.FontPanel.lblDetailBackcolor.BackColor = ColorDetailBackcolor;
653 this.FontPanel.lblDetail.ForeColor = ColorDetail;
654 this.FontPanel.lblDetailLink.ForeColor = ColorDetailLink;
658 case MyCommon.NameBalloonEnum.None:
659 this.PreviewPanel.cmbNameBalloon.SelectedIndex = 0;
661 case MyCommon.NameBalloonEnum.UserID:
662 this.PreviewPanel.cmbNameBalloon.SelectedIndex = 1;
664 case MyCommon.NameBalloonEnum.NickName:
665 this.PreviewPanel.cmbNameBalloon.SelectedIndex = 2;
671 this.TweetActPanel.ComboBoxPostKeySelect.SelectedIndex = 1;
673 else if (PostShiftEnter)
675 this.TweetActPanel.ComboBoxPostKeySelect.SelectedIndex = 2;
679 this.TweetActPanel.ComboBoxPostKeySelect.SelectedIndex = 0;
682 this.GetCountPanel.TextCountApi.Text = CountApi.ToString();
683 this.GetCountPanel.TextCountApiReply.Text = CountApiReply.ToString();
684 this.ActionPanel.BrowserPathText.Text = BrowserPath;
685 this.GetPeriodPanel.CheckPostAndGet.Checked = PostAndGet;
686 this.TweetActPanel.CheckUseRecommendStatus.Checked = UseRecommendStatus;
687 this.PreviewPanel.CheckDispUsername.Checked = DispUsername;
688 this.ActionPanel.CheckCloseToExit.Checked = CloseToExit;
689 this.ActionPanel.CheckMinimizeToTray.Checked = MinimizeToTray;
690 switch (DispLatestPost)
692 case MyCommon.DispTitleEnum.None:
693 this.PreviewPanel.ComboDispTitle.SelectedIndex = 0;
695 case MyCommon.DispTitleEnum.Ver:
696 this.PreviewPanel.ComboDispTitle.SelectedIndex = 1;
698 case MyCommon.DispTitleEnum.Post:
699 this.PreviewPanel.ComboDispTitle.SelectedIndex = 2;
701 case MyCommon.DispTitleEnum.UnreadRepCount:
702 this.PreviewPanel.ComboDispTitle.SelectedIndex = 3;
704 case MyCommon.DispTitleEnum.UnreadAllCount:
705 this.PreviewPanel.ComboDispTitle.SelectedIndex = 4;
707 case MyCommon.DispTitleEnum.UnreadAllRepCount:
708 this.PreviewPanel.ComboDispTitle.SelectedIndex = 5;
710 case MyCommon.DispTitleEnum.UnreadCountAllCount:
711 this.PreviewPanel.ComboDispTitle.SelectedIndex = 6;
713 case MyCommon.DispTitleEnum.OwnStatus:
714 this.PreviewPanel.ComboDispTitle.SelectedIndex = 7;
717 this.TweetPrvPanel.CheckSortOrderLock.Checked = SortOrderLock;
718 this.TweetPrvPanel.CheckViewTabBottom.Checked = ViewTabBottom;
719 this.ShortUrlPanel.CheckTinyURL.Checked = TinyUrlResolve;
720 switch (_MyProxyType)
722 case HttpConnection.ProxyType.None:
723 this.ProxyPanel.RadioProxyNone.Checked = true;
725 case HttpConnection.ProxyType.IE:
726 this.ProxyPanel.RadioProxyIE.Checked = true;
729 this.ProxyPanel.RadioProxySpecified.Checked = true;
732 bool chk = this.ProxyPanel.RadioProxySpecified.Checked;
733 this.ProxyPanel.LabelProxyAddress.Enabled = chk;
734 this.ProxyPanel.TextProxyAddress.Enabled = chk;
735 this.ProxyPanel.LabelProxyPort.Enabled = chk;
736 this.ProxyPanel.TextProxyPort.Enabled = chk;
737 this.ProxyPanel.LabelProxyUser.Enabled = chk;
738 this.ProxyPanel.TextProxyUser.Enabled = chk;
739 this.ProxyPanel.LabelProxyPassword.Enabled = chk;
740 this.ProxyPanel.TextProxyPassword.Enabled = chk;
742 this.ProxyPanel.TextProxyAddress.Text = ProxyAddress;
743 this.ProxyPanel.TextProxyPort.Text = ProxyPort.ToString();
744 this.ProxyPanel.TextProxyUser.Text = ProxyUser;
745 this.ProxyPanel.TextProxyPassword.Text = ProxyPassword;
747 this.StartupPanel.CheckStartupVersion.Checked = StartupVersion;
748 if (ApplicationSettings.VersionInfoUrl == null)
749 this.StartupPanel.CheckStartupVersion.Enabled = false; // 更新チェック無効化
750 this.StartupPanel.CheckStartupFollowers.Checked = StartupFollowers;
751 this.ActionPanel.CheckFavRestrict.Checked = RestrictFavCheck;
752 this.PreviewPanel.CheckAlwaysTop.Checked = AlwaysTop;
753 this.ShortUrlPanel.CheckAutoConvertUrl.Checked = UrlConvertAuto;
754 this.ShortUrlPanel.ShortenTcoCheck.Checked = ShortenTco;
755 this.ShortUrlPanel.ShortenTcoCheck.Enabled = this.ShortUrlPanel.CheckAutoConvertUrl.Checked;
757 this.CooperatePanel.CheckNicoms.Checked = Nicoms;
758 this.TweetPrvPanel.chkUnreadStyle.Checked = UseUnreadStyle;
759 this.TweetPrvPanel.CmbDateTimeFormat.Text = DateTimeFormat;
760 this.ConnectionPanel.ConnectionTimeOut.Text = DefaultTimeOut.ToString();
761 this.TweetActPanel.CheckRetweetNoConfirm.Checked = RetweetNoConfirm;
762 this.PreviewPanel.CheckBalloonLimit.Checked = LimitBalloon;
764 ApplyEventNotifyFlag(EventNotifyEnabled, EventNotifyFlag, IsMyEventNotifyFlag);
765 this.NotifyPanel.CheckForceEventNotify.Checked = ForceEventNotify;
766 this.NotifyPanel.CheckFavEventUnread.Checked = FavEventUnread;
767 this.CooperatePanel.ComboBoxTranslateLanguage.SelectedIndex = (new Bing()).GetIndexFromLanguageEnum(TranslateLanguage);
769 this.ShortUrlPanel.ComboBoxAutoShortUrlFirst.SelectedIndex = (int)AutoShortUrlFirst;
770 this.PreviewPanel.chkTabIconDisp.Checked = TabIconDisp;
771 this.ActionPanel.chkReadOwnPost.Checked = ReadOwnPost;
772 this.StartupPanel.chkGetFav.Checked = GetFav;
773 this.PreviewPanel.CheckMonospace.Checked = IsMonospace;
774 this.ActionPanel.CheckReadOldPosts.Checked = ReadOldPosts;
775 this.ShortUrlPanel.TextBitlyId.Text = BitlyUser;
776 this.ShortUrlPanel.TextBitlyPw.Text = BitlyPwd;
777 this.ShortUrlPanel.TextBitlyId.Modified = false;
778 this.ShortUrlPanel.TextBitlyPw.Modified = false;
779 this.TweetPrvPanel.CheckShowGrid.Checked = ShowGrid;
780 this.TweetActPanel.CheckAtIdSupple.Checked = UseAtIdSupplement;
781 this.TweetActPanel.CheckHashSupple.Checked = UseHashSupplement;
782 this.PreviewPanel.CheckPreviewEnable.Checked = PreviewEnable;
783 this.ConnectionPanel.TwitterAPIText.Text = TwitterApiUrl;
784 switch (ReplyIconState)
786 case MyCommon.REPLY_ICONSTATE.None:
787 this.PreviewPanel.ReplyIconStateCombo.SelectedIndex = 0;
789 case MyCommon.REPLY_ICONSTATE.StaticIcon:
790 this.PreviewPanel.ReplyIconStateCombo.SelectedIndex = 1;
792 case MyCommon.REPLY_ICONSTATE.BlinkIcon:
793 this.PreviewPanel.ReplyIconStateCombo.SelectedIndex = 2;
799 this.PreviewPanel.LanguageCombo.SelectedIndex = 0;
802 this.PreviewPanel.LanguageCombo.SelectedIndex = 1;
805 this.PreviewPanel.LanguageCombo.SelectedIndex = 2;
808 this.PreviewPanel.LanguageCombo.SelectedIndex = 3;
811 this.PreviewPanel.LanguageCombo.SelectedIndex = 0;
814 this.ActionPanel.HotkeyCheck.Checked = HotkeyEnabled;
815 this.ActionPanel.HotkeyAlt.Checked = ((HotkeyMod & Keys.Alt) == Keys.Alt);
816 this.ActionPanel.HotkeyCtrl.Checked = ((HotkeyMod & Keys.Control) == Keys.Control);
817 this.ActionPanel.HotkeyShift.Checked = ((HotkeyMod & Keys.Shift) == Keys.Shift);
818 this.ActionPanel.HotkeyWin.Checked = ((HotkeyMod & Keys.LWin) == Keys.LWin);
819 this.ActionPanel.HotkeyCode.Text = HotkeyValue.ToString();
820 this.ActionPanel.HotkeyText.Text = HotkeyKey.ToString();
821 this.ActionPanel.HotkeyText.Tag = HotkeyKey;
822 this.ActionPanel.HotkeyAlt.Enabled = HotkeyEnabled;
823 this.ActionPanel.HotkeyShift.Enabled = HotkeyEnabled;
824 this.ActionPanel.HotkeyCtrl.Enabled = HotkeyEnabled;
825 this.ActionPanel.HotkeyWin.Enabled = HotkeyEnabled;
826 this.ActionPanel.HotkeyText.Enabled = HotkeyEnabled;
827 this.ActionPanel.HotkeyCode.Enabled = HotkeyEnabled;
828 this.PreviewPanel.ChkNewMentionsBlink.Checked = BlinkNewMentions;
830 this.GetCountPanel.GetMoreTextCountApi.Text = MoreCountApi.ToString();
831 this.GetCountPanel.FirstTextCountApi.Text = FirstCountApi.ToString();
832 this.GetCountPanel.SearchTextCountApi.Text = SearchCountApi.ToString();
833 this.GetCountPanel.FavoritesTextCountApi.Text = FavoritesCountApi.ToString();
834 this.GetCountPanel.UserTimelineTextCountApi.Text = UserTimelineCountApi.ToString();
835 this.GetCountPanel.ListTextCountApi.Text = ListCountApi.ToString();
836 this.GetCountPanel.UseChangeGetCount.Checked = UseAdditionalCount;
837 this.GetCountPanel.Label28.Enabled = this.GetCountPanel.UseChangeGetCount.Checked;
838 this.GetCountPanel.Label30.Enabled = this.GetCountPanel.UseChangeGetCount.Checked;
839 this.GetCountPanel.Label53.Enabled = this.GetCountPanel.UseChangeGetCount.Checked;
840 this.GetCountPanel.Label66.Enabled = this.GetCountPanel.UseChangeGetCount.Checked;
841 this.GetCountPanel.Label17.Enabled = this.GetCountPanel.UseChangeGetCount.Checked;
842 this.GetCountPanel.Label25.Enabled = this.GetCountPanel.UseChangeGetCount.Checked;
843 this.GetCountPanel.GetMoreTextCountApi.Enabled = this.GetCountPanel.UseChangeGetCount.Checked;
844 this.GetCountPanel.FirstTextCountApi.Enabled = this.GetCountPanel.UseChangeGetCount.Checked;
845 this.GetCountPanel.SearchTextCountApi.Enabled = this.GetCountPanel.UseChangeGetCount.Checked;
846 this.GetCountPanel.FavoritesTextCountApi.Enabled = this.GetCountPanel.UseChangeGetCount.Checked;
847 this.GetCountPanel.UserTimelineTextCountApi.Enabled = this.GetCountPanel.UseChangeGetCount.Checked;
848 this.GetCountPanel.ListTextCountApi.Enabled = this.GetCountPanel.UseChangeGetCount.Checked;
849 this.ActionPanel.CheckOpenUserTimeline.Checked = OpenUserTimeline;
850 this.ActionPanel.ListDoubleClickActionComboBox.SelectedIndex = ListDoubleClickAction;
851 this.CooperatePanel.UserAppointUrlText.Text = UserAppointUrl;
852 this.TweetPrvPanel.HideDuplicatedRetweetsCheck.Checked = this.HideDuplicatedRetweets;
853 this.CooperatePanel.IsPreviewFoursquareCheckBox.Checked = this.IsPreviewFoursquare;
854 this.CooperatePanel.MapThumbnailProviderComboBox.SelectedIndex = (int)this.MapThumbnailProvider;
855 this.CooperatePanel.MapThumbnailHeightTextBox.Text = this.MapThumbnailHeight.ToString();
856 this.CooperatePanel.MapThumbnailWidthTextBox.Text = this.MapThumbnailWidth.ToString();
857 this.CooperatePanel.MapThumbnailZoomTextBox.Text = this.MapThumbnailZoom.ToString();
858 this.TweetPrvPanel.IsListsIncludeRtsCheckBox.Checked = this.IsListStatusesIncludeRts;
859 this.ActionPanel.TabMouseLockCheck.Checked = this.TabMouseLock;
860 this.NotifyPanel.IsRemoveSameFavEventCheckBox.Checked = this.IsRemoveSameEvent;
861 this.PreviewPanel.IsNotifyUseGrowlCheckBox.Checked = this.IsNotifyUseGrowl;
863 if (GrowlHelper.IsDllExists)
865 this.PreviewPanel.IsNotifyUseGrowlCheckBox.Enabled = true;
869 this.PreviewPanel.IsNotifyUseGrowlCheckBox.Enabled = false;
872 this.TreeViewSetting.Nodes["BasedNode"].Tag = BasedPanel;
873 this.TreeViewSetting.Nodes["BasedNode"].Nodes["PeriodNode"].Tag = GetPeriodPanel;
874 this.TreeViewSetting.Nodes["BasedNode"].Nodes["StartUpNode"].Tag = StartupPanel;
875 this.TreeViewSetting.Nodes["BasedNode"].Nodes["GetCountNode"].Tag = GetCountPanel;
876 //this.TreeViewSetting.Nodes["BasedNode"].Nodes["UserStreamNode"].Tag = UserStreamPanel;
877 this.TreeViewSetting.Nodes["ActionNode"].Tag = ActionPanel;
878 this.TreeViewSetting.Nodes["ActionNode"].Nodes["TweetActNode"].Tag = TweetActPanel;
879 this.TreeViewSetting.Nodes["PreviewNode"].Tag = PreviewPanel;
880 this.TreeViewSetting.Nodes["PreviewNode"].Nodes["TweetPrvNode"].Tag = TweetPrvPanel;
881 this.TreeViewSetting.Nodes["PreviewNode"].Nodes["NotifyNode"].Tag = NotifyPanel;
882 this.TreeViewSetting.Nodes["FontNode"].Tag = FontPanel;
883 this.TreeViewSetting.Nodes["FontNode"].Nodes["FontNode2"].Tag = FontPanel2;
884 this.TreeViewSetting.Nodes["ConnectionNode"].Tag = ConnectionPanel;
885 this.TreeViewSetting.Nodes["ConnectionNode"].Nodes["ProxyNode"].Tag = ProxyPanel;
886 this.TreeViewSetting.Nodes["ConnectionNode"].Nodes["CooperateNode"].Tag = CooperatePanel;
887 this.TreeViewSetting.Nodes["ConnectionNode"].Nodes["ShortUrlNode"].Tag = ShortUrlPanel;
889 this.TreeViewSetting.SelectedNode = this.TreeViewSetting.Nodes[0];
890 this.TreeViewSetting.ExpandAll();
892 //TreeViewSetting.SelectedNode = TreeViewSetting.TopNode;
893 ActiveControl = BasedPanel.StartAuthButton;
896 private void UReadMng_CheckedChanged(object sender, EventArgs e)
898 if (this.ActionPanel.UReadMng.Checked == true)
900 this.StartupPanel.StartupReaded.Enabled = true;
904 this.StartupPanel.StartupReaded.Enabled = false;
908 private void btnFontAndColor_Click(object sender, EventArgs e) // Handles btnUnread.Click, btnDetail.Click, btnListFont.Click, btnInputFont.Click
910 Button Btn = (Button) sender;
913 FontDialog1.AllowVerticalFonts = false;
914 FontDialog1.AllowScriptChange = true;
915 FontDialog1.AllowSimulations = true;
916 FontDialog1.AllowVectorFonts = true;
917 FontDialog1.FixedPitchOnly = false;
918 FontDialog1.FontMustExist = true;
919 FontDialog1.ScriptsOnly = false;
920 FontDialog1.ShowApply = false;
921 FontDialog1.ShowEffects = true;
922 FontDialog1.ShowColor = true;
927 FontDialog1.Color = this.FontPanel.lblUnread.ForeColor;
928 FontDialog1.Font = this.FontPanel.lblUnread.Font;
931 FontDialog1.Color = this.FontPanel.lblDetail.ForeColor;
932 FontDialog1.Font = this.FontPanel.lblDetail.Font;
935 FontDialog1.Color = this.FontPanel.lblListFont.ForeColor;
936 FontDialog1.Font = this.FontPanel.lblListFont.Font;
939 FontDialog1.Color = this.FontPanel2.lblInputFont.ForeColor;
940 FontDialog1.Font = this.FontPanel2.lblInputFont.Font;
946 rtn = FontDialog1.ShowDialog();
948 catch(ArgumentException ex)
950 MessageBox.Show(ex.Message);
954 if (rtn == DialogResult.Cancel) return;
959 this.FontPanel.lblUnread.ForeColor = FontDialog1.Color;
960 this.FontPanel.lblUnread.Font = FontDialog1.Font;
963 this.FontPanel.lblDetail.ForeColor = FontDialog1.Color;
964 this.FontPanel.lblDetail.Font = FontDialog1.Font;
967 this.FontPanel.lblListFont.ForeColor = FontDialog1.Color;
968 this.FontPanel.lblListFont.Font = FontDialog1.Font;
971 this.FontPanel2.lblInputFont.ForeColor = FontDialog1.Color;
972 this.FontPanel2.lblInputFont.Font = FontDialog1.Font;
978 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
980 Button Btn = (Button)sender;
983 ColorDialog1.AllowFullOpen = true;
984 ColorDialog1.AnyColor = true;
985 ColorDialog1.FullOpen = false;
986 ColorDialog1.SolidColorOnly = false;
991 ColorDialog1.Color = this.FontPanel2.lblSelf.BackColor;
994 ColorDialog1.Color = this.FontPanel2.lblAtSelf.BackColor;
997 ColorDialog1.Color = this.FontPanel2.lblTarget.BackColor;
1000 ColorDialog1.Color = this.FontPanel2.lblAtTarget.BackColor;
1002 case "btnAtFromTarget":
1003 ColorDialog1.Color = this.FontPanel2.lblAtFromTarget.BackColor;
1006 ColorDialog1.Color = this.FontPanel.lblFav.ForeColor;
1009 ColorDialog1.Color = this.FontPanel.lblOWL.ForeColor;
1012 ColorDialog1.Color = this.FontPanel.lblRetweet.ForeColor;
1014 case "btnInputBackcolor":
1015 ColorDialog1.Color = this.FontPanel2.lblInputBackcolor.BackColor;
1018 ColorDialog1.Color = this.FontPanel2.lblAtTo.BackColor;
1021 ColorDialog1.Color = this.FontPanel2.lblListBackcolor.BackColor;
1023 case "btnDetailBack":
1024 ColorDialog1.Color = this.FontPanel.lblDetailBackcolor.BackColor;
1026 case "btnDetailLink":
1027 ColorDialog1.Color = this.FontPanel.lblDetailLink.ForeColor;
1031 rtn = ColorDialog1.ShowDialog();
1033 if (rtn == DialogResult.Cancel) return;
1038 this.FontPanel2.lblSelf.BackColor = ColorDialog1.Color;
1041 this.FontPanel2.lblAtSelf.BackColor = ColorDialog1.Color;
1044 this.FontPanel2.lblTarget.BackColor = ColorDialog1.Color;
1047 this.FontPanel2.lblAtTarget.BackColor = ColorDialog1.Color;
1049 case "btnAtFromTarget":
1050 this.FontPanel2.lblAtFromTarget.BackColor = ColorDialog1.Color;
1053 this.FontPanel.lblFav.ForeColor = ColorDialog1.Color;
1056 this.FontPanel.lblOWL.ForeColor = ColorDialog1.Color;
1059 this.FontPanel.lblRetweet.ForeColor = ColorDialog1.Color;
1061 case "btnInputBackcolor":
1062 this.FontPanel2.lblInputBackcolor.BackColor = ColorDialog1.Color;
1065 this.FontPanel2.lblAtTo.BackColor = ColorDialog1.Color;
1068 this.FontPanel2.lblListBackcolor.BackColor = ColorDialog1.Color;
1070 case "btnDetailBack":
1071 this.FontPanel.lblDetailBackcolor.BackColor = ColorDialog1.Color;
1073 case "btnDetailLink":
1074 this.FontPanel.lblDetailLink.ForeColor = ColorDialog1.Color;
1079 public int UserstreamPeriodInt { get; set; }
1080 public bool UserstreamStartup { get; set; }
1081 public int TimelinePeriodInt { get; set; }
1082 public int ReplyPeriodInt { get; set; }
1083 public int DMPeriodInt { get; set; }
1084 public int PubSearchPeriodInt { get; set; }
1085 public int ListsPeriodInt { get; set; }
1086 public int UserTimelinePeriodInt { get; set; }
1087 public bool Readed { get; set; }
1088 public MyCommon.IconSizes IconSz { get; set; }
1089 public string Status { get; set; }
1090 public bool UnreadManage { get; set; }
1091 public bool PlaySound { get; set; }
1092 public bool OneWayLove { get; set; }
1093 public Font FontUnread { get; set; } /////未使用
1094 public Color ColorUnread { get; set; }
1095 public Font FontReaded { get; set; } /////リストフォントとして使用
1096 public Color ColorReaded { get; set; }
1097 public Color ColorFav { get; set; }
1098 public Color ColorOWL { get; set; }
1099 public Color ColorRetweet { get; set; }
1100 public Font FontDetail { get; set; }
1101 public Color ColorDetail { get; set; }
1102 public Color ColorDetailLink { get; set; }
1103 public Color ColorSelf { get; set; }
1104 public Color ColorAtSelf { get; set; }
1105 public Color ColorTarget { get; set; }
1106 public Color ColorAtTarget { get; set; }
1107 public Color ColorAtFromTarget { get; set; }
1108 public Color ColorAtTo { get; set; }
1109 public Color ColorInputBackcolor { get; set; }
1110 public Color ColorInputFont { get; set; }
1111 public Font FontInputFont { get; set; }
1112 public Color ColorListBackcolor { get; set; }
1113 public Color ColorDetailBackcolor { get; set; }
1114 public MyCommon.NameBalloonEnum NameBalloon { get; set; }
1115 public bool PostCtrlEnter { get; set; }
1116 public bool PostShiftEnter { get; set; }
1117 public int CountApi { get; set; }
1118 public int CountApiReply { get; set; }
1119 public int MoreCountApi { get; set; }
1120 public int FirstCountApi { get; set; }
1121 public int SearchCountApi { get; set; }
1122 public int FavoritesCountApi { get; set; }
1123 public int UserTimelineCountApi { get; set; }
1124 public int ListCountApi { get; set; }
1125 public bool PostAndGet { get; set; }
1126 public bool UseRecommendStatus { get; set; }
1127 public string RecommendStatusText { get; set; }
1128 public bool DispUsername { get; set; }
1129 public bool CloseToExit { get; set; }
1130 public bool MinimizeToTray { get; set; }
1131 public MyCommon.DispTitleEnum DispLatestPost { get; set; }
1132 public string BrowserPath { get; set; }
1133 public bool TinyUrlResolve { get; set; }
1135 public bool SortOrderLock { get; set; }
1136 public HttpConnection.ProxyType SelectedProxyType
1139 return _MyProxyType;
1142 _MyProxyType = value;
1146 /// タブを下部に表示するかどうかを取得または設定する
1148 public bool ViewTabBottom { get; set; }
1150 public string ProxyAddress { get; set; }
1151 public int ProxyPort { get; set; }
1152 public string ProxyUser { get; set; }
1153 public string ProxyPassword { get; set; }
1154 public bool StartupVersion { get; set; }
1155 public bool StartupFollowers { get; set; }
1156 public bool RestrictFavCheck { get; set; }
1157 public bool AlwaysTop { get; set; }
1158 public bool UrlConvertAuto { get; set; }
1159 public bool ShortenTco { get; set; }
1160 public bool Nicoms { get; set; }
1161 public MyCommon.UrlConverter AutoShortUrlFirst { get; set; }
1162 public bool UseUnreadStyle { get; set; }
1163 public string DateTimeFormat { get; set; }
1164 public int DefaultTimeOut { get; set; }
1165 public bool RetweetNoConfirm { get; set; }
1166 public bool TabIconDisp { get; set; }
1167 public MyCommon.REPLY_ICONSTATE ReplyIconState { get; set; }
1168 public bool ReadOwnPost { get; set; }
1169 public bool GetFav { get; set; }
1170 public bool IsMonospace { get; set; }
1171 public bool ReadOldPosts { get; set; }
1172 public string BitlyUser { get; set; }
1173 public string BitlyPwd { get; set; }
1174 public bool ShowGrid { get; set; }
1175 public bool UseAtIdSupplement { get; set; }
1176 public bool UseHashSupplement { get; set; }
1177 public bool PreviewEnable { get; set; }
1178 public bool UseAdditionalCount { get; set; }
1179 public bool OpenUserTimeline { get; set; }
1180 public string TwitterApiUrl { get; set; }
1181 public string Language { get; set; }
1183 public bool LimitBalloon { get; set; }
1184 public bool EventNotifyEnabled { get; set; }
1186 public MyCommon.EVENTTYPE EventNotifyFlag
1190 return _MyEventNotifyFlag;
1194 _MyEventNotifyFlag = value;
1198 public MyCommon.EVENTTYPE IsMyEventNotifyFlag
1202 return _isMyEventNotifyFlag;
1206 _isMyEventNotifyFlag = value;
1210 public bool ForceEventNotify { get; set; }
1211 public bool FavEventUnread { get; set; }
1213 public string TranslateLanguage
1217 return _MyTranslateLanguage;
1221 _MyTranslateLanguage = value;
1222 this.CooperatePanel.ComboBoxTranslateLanguage.SelectedIndex = (new Bing()).GetIndexFromLanguageEnum(value);
1226 public string EventSoundFile { get; set; }
1227 public int ListDoubleClickAction { get; set; }
1228 public string UserAppointUrl { get; set; }
1230 private bool StartAuth()
1233 HttpConnection.ProxyType ptype;
1234 if (this.ProxyPanel.RadioProxyNone.Checked)
1236 ptype = HttpConnection.ProxyType.None;
1238 else if (this.ProxyPanel.RadioProxyIE.Checked)
1240 ptype = HttpConnection.ProxyType.IE;
1244 ptype = HttpConnection.ProxyType.Specified;
1246 string padr = this.ProxyPanel.TextProxyAddress.Text.Trim();
1247 int pport = int.Parse(this.ProxyPanel.TextProxyPort.Text.Trim());
1248 string pusr = this.ProxyPanel.TextProxyUser.Text.Trim();
1249 string ppw = this.ProxyPanel.TextProxyPassword.Text.Trim();
1252 HttpConnection.InitializeConnection(20, ptype, padr, pport, pusr, ppw);
1253 HttpTwitter.TwitterUrl = this.ConnectionPanel.TwitterAPIText.Text.Trim();
1254 tw.Initialize("", "", "", 0);
1255 //this.AuthStateLabel.Text = Properties.Resources.AuthorizeButton_Click4;
1256 //this.AuthUserLabel.Text = "";
1257 string pinPageUrl = "";
1258 string rslt = tw.StartAuthentication(ref pinPageUrl);
1259 if (string.IsNullOrEmpty(rslt))
1261 string pin = AuthDialog.DoAuth(this, pinPageUrl);
1262 if (!string.IsNullOrEmpty(pin))
1274 MessageBox.Show(Properties.Resources.AuthorizeButton_Click2 + Environment.NewLine + rslt, "Authenticate", MessageBoxButtons.OK);
1279 private bool PinAuth()
1281 string pin = this._pin; //PIN Code
1283 string rslt = tw.Authenticate(pin);
1284 if (string.IsNullOrEmpty(rslt))
1286 MessageBox.Show(Properties.Resources.AuthorizeButton_Click1, "Authenticate", MessageBoxButtons.OK);
1287 //this.AuthStateLabel.Text = Properties.Resources.AuthorizeButton_Click3;
1288 //this.AuthUserLabel.Text = tw.Username;
1290 UserAccount user = new UserAccount();
1291 user.Username = tw.Username;
1292 user.UserId = tw.UserId;
1293 user.Token = tw.AccessToken;
1294 user.TokenSecret = tw.AccessTokenSecret;
1296 foreach (object u in this.BasedPanel.AuthUserCombo.Items)
1298 if (((UserAccount)u).Username.ToLower() == tw.Username.ToLower())
1300 idx = this.BasedPanel.AuthUserCombo.Items.IndexOf(u);
1306 this.BasedPanel.AuthUserCombo.Items.RemoveAt(idx);
1307 this.BasedPanel.AuthUserCombo.Items.Insert(idx, user);
1308 this.BasedPanel.AuthUserCombo.SelectedIndex = idx;
1312 this.BasedPanel.AuthUserCombo.SelectedIndex = this.BasedPanel.AuthUserCombo.Items.Add(user);
1314 //if (TwitterApiInfo.AccessLevel = ApiAccessLevel.ReadWrite)
1316 // this.AuthStateLabel.Text += "(xAuth)";
1318 //else if (TwitterApiInfo.AccessLevel == ApiAccessLevel.ReadWriteAndDirectMessage)
1320 // this.AuthStateLabel.Text += "(OAuth)";
1326 MessageBox.Show(Properties.Resources.AuthorizeButton_Click2 + Environment.NewLine + rslt, "Authenticate", MessageBoxButtons.OK);
1327 //this.AuthStateLabel.Text = Properties.Resources.AuthorizeButton_Click4;
1328 //this.AuthUserLabel.Text = "";
1333 private void StartAuthButton_Click(object sender, EventArgs e)
1335 //this.Save.Enabled = false;
1340 //this.Save.Enabled = true;
1345 private void CheckPostAndGet_CheckedChanged(object sender, EventArgs e)
1347 this.GetPeriodPanel.LabelPostAndGet.Visible = this.GetPeriodPanel.CheckPostAndGet.Checked && !tw.UserStreamEnabled;
1350 private void Setting_Shown(object sender, EventArgs e)
1355 if (this.Disposing || this.IsDisposed) return;
1356 } while (!this.IsHandleCreated);
1357 this.TopMost = this.AlwaysTop;
1359 this.GetPeriodPanel.LabelPostAndGet.Visible = this.GetPeriodPanel.CheckPostAndGet.Checked && !tw.UserStreamEnabled;
1360 this.GetPeriodPanel.LabelUserStreamActive.Visible = tw.UserStreamEnabled;
1363 public static AppendSettingDialog Instance
1365 get { return _instance; }
1368 private bool BitlyValidation(string id, string apikey)
1370 if (string.IsNullOrEmpty(id) || string.IsNullOrEmpty(apikey))
1375 string req = "http://api.bit.ly/v3/validate";
1376 string content = "";
1377 Dictionary<string, string> param = new Dictionary<string, string>();
1379 param.Add("login", ApplicationSettings.BitlyLoginId);
1380 param.Add("apiKey", ApplicationSettings.BitlyApiKey);
1381 param.Add("x_login", id);
1382 param.Add("x_apiKey", apikey);
1383 param.Add("format", "txt");
1385 if (!(new HttpVarious()).PostData(req, param, out content))
1387 return true; // 通信エラーの場合はとりあえずチェックを通ったことにする
1389 else if (content.Trim() == "1")
1391 return true; // 検証成功
1393 else if (content.Trim() == "0")
1395 return false; // 検証失敗 APIキーとIDの組み合わせが違う
1399 return true; // 規定外応答:通信エラーの可能性があるためとりあえずチェックを通ったことにする
1403 private void Cancel_Click(object sender, EventArgs e)
1405 _ValidationError = false;
1408 public bool HotkeyEnabled;
1409 public Keys HotkeyKey;
1410 public int HotkeyValue;
1411 public Keys HotkeyMod;
1413 public bool BlinkNewMentions;
1415 //private void CheckEventNotify_CheckedChanged(object sender, EventArgs e)
1416 // Handles CheckEventNotify.CheckedChanged, CheckFavoritesEvent.CheckStateChanged,
1417 // CheckUnfavoritesEvent.CheckStateChanged, CheckFollowEvent.CheckStateChanged,
1418 // CheckListMemberAddedEvent.CheckStateChanged, CheckListMemberRemovedEvent.CheckStateChanged,
1419 // CheckListCreatedEvent.CheckStateChanged, CheckUserUpdateEvent.CheckStateChanged
1421 // EventNotifyEnabled = CheckEventNotify.Checked;
1422 // GetEventNotifyFlag(EventNotifyFlag, IsMyEventNotifyFlag);
1423 // ApplyEventNotifyFlag(EventNotifyEnabled, EventNotifyFlag, IsMyEventNotifyFlag);
1426 private class EventCheckboxTblElement
1428 public CheckBox CheckBox;
1429 public MyCommon.EVENTTYPE Type;
1432 private EventCheckboxTblElement[] GetEventCheckboxTable()
1434 EventCheckboxTblElement[] _eventCheckboxTable = new EventCheckboxTblElement[8];
1436 _eventCheckboxTable[0] = new EventCheckboxTblElement();
1437 _eventCheckboxTable[0].CheckBox = this.NotifyPanel.CheckFavoritesEvent;
1438 _eventCheckboxTable[0].Type = MyCommon.EVENTTYPE.Favorite;
1440 _eventCheckboxTable[1] = new EventCheckboxTblElement();
1441 _eventCheckboxTable[1].CheckBox = this.NotifyPanel.CheckUnfavoritesEvent;
1442 _eventCheckboxTable[1].Type = MyCommon.EVENTTYPE.Unfavorite;
1444 _eventCheckboxTable[2] = new EventCheckboxTblElement();
1445 _eventCheckboxTable[2].CheckBox = this.NotifyPanel.CheckFollowEvent;
1446 _eventCheckboxTable[2].Type = MyCommon.EVENTTYPE.Follow;
1448 _eventCheckboxTable[3] = new EventCheckboxTblElement();
1449 _eventCheckboxTable[3].CheckBox = this.NotifyPanel.CheckListMemberAddedEvent;
1450 _eventCheckboxTable[3].Type = MyCommon.EVENTTYPE.ListMemberAdded;
1452 _eventCheckboxTable[4] = new EventCheckboxTblElement();
1453 _eventCheckboxTable[4].CheckBox = this.NotifyPanel.CheckListMemberRemovedEvent;
1454 _eventCheckboxTable[4].Type = MyCommon.EVENTTYPE.ListMemberRemoved;
1456 _eventCheckboxTable[5] = new EventCheckboxTblElement();
1457 _eventCheckboxTable[5].CheckBox = this.NotifyPanel.CheckBlockEvent;
1458 _eventCheckboxTable[5].Type = MyCommon.EVENTTYPE.Block;
1460 _eventCheckboxTable[6] = new EventCheckboxTblElement();
1461 _eventCheckboxTable[6].CheckBox = this.NotifyPanel.CheckUserUpdateEvent;
1462 _eventCheckboxTable[6].Type = MyCommon.EVENTTYPE.UserUpdate;
1464 _eventCheckboxTable[7] = new EventCheckboxTblElement();
1465 _eventCheckboxTable[7].CheckBox = this.NotifyPanel.CheckListCreatedEvent;
1466 _eventCheckboxTable[7].Type = MyCommon.EVENTTYPE.ListCreated;
1468 return _eventCheckboxTable;
1471 private void GetEventNotifyFlag(ref MyCommon.EVENTTYPE eventnotifyflag, ref MyCommon.EVENTTYPE isMyeventnotifyflag)
1473 MyCommon.EVENTTYPE evt = MyCommon.EVENTTYPE.None;
1474 MyCommon.EVENTTYPE myevt = MyCommon.EVENTTYPE.None;
1476 foreach (EventCheckboxTblElement tbl in GetEventCheckboxTable())
1478 switch (tbl.CheckBox.CheckState)
1480 case CheckState.Checked:
1481 evt = evt | tbl.Type;
1482 myevt = myevt | tbl.Type;
1484 case CheckState.Indeterminate:
1485 evt = evt | tbl.Type;
1487 case CheckState.Unchecked:
1491 eventnotifyflag = evt;
1492 isMyeventnotifyflag = myevt;
1495 private void ApplyEventNotifyFlag(bool rootEnabled, MyCommon.EVENTTYPE eventnotifyflag, MyCommon.EVENTTYPE isMyeventnotifyflag)
1497 MyCommon.EVENTTYPE evt = eventnotifyflag;
1498 MyCommon.EVENTTYPE myevt = isMyeventnotifyflag;
1500 this.NotifyPanel.CheckEventNotify.Checked = rootEnabled;
1502 foreach (EventCheckboxTblElement tbl in GetEventCheckboxTable())
1504 if ((evt & tbl.Type) != 0)
1506 if ((myevt & tbl.Type) != 0)
1508 tbl.CheckBox.CheckState = CheckState.Checked;
1512 tbl.CheckBox.CheckState = CheckState.Indeterminate;
1517 tbl.CheckBox.CheckState = CheckState.Unchecked;
1519 tbl.CheckBox.Enabled = rootEnabled;
1524 private void CheckEventNotify_CheckedChanged(object sender, EventArgs e)
1526 foreach (EventCheckboxTblElement tbl in GetEventCheckboxTable())
1528 tbl.CheckBox.Enabled = this.NotifyPanel.CheckEventNotify.Checked;
1532 //private void CheckForceEventNotify_CheckedChanged(object sender, EventArgs e)
1534 // _MyForceEventNotify = CheckEventNotify.Checked;
1537 //private void CheckFavEventUnread_CheckedChanged(object sender, EventArgs e)
1539 // _MyFavEventUnread = CheckFavEventUnread.Checked;
1542 //private void ComboBoxTranslateLanguage_SelectedIndexChanged(object sender, EventArgs e)
1544 // _MyTranslateLanguage = (new Google()).GetLanguageEnumFromIndex(ComboBoxTranslateLanguage.SelectedIndex);
1547 private void SoundFileListup()
1549 if (EventSoundFile == null) EventSoundFile = "";
1550 this.NotifyPanel.ComboBoxEventNotifySound.Items.Clear();
1551 this.NotifyPanel.ComboBoxEventNotifySound.Items.Add("");
1552 DirectoryInfo oDir = new DirectoryInfo(Application.StartupPath + Path.DirectorySeparatorChar);
1553 if (Directory.Exists(Path.Combine(Application.StartupPath, "Sounds")))
1555 oDir = oDir.GetDirectories("Sounds")[0];
1557 foreach (FileInfo oFile in oDir.GetFiles("*.wav"))
1559 this.NotifyPanel.ComboBoxEventNotifySound.Items.Add(oFile.Name);
1561 int idx = this.NotifyPanel.ComboBoxEventNotifySound.Items.IndexOf(EventSoundFile);
1562 if (idx == -1) idx = 0;
1563 this.NotifyPanel.ComboBoxEventNotifySound.SelectedIndex = idx;
1566 //private void ComboBoxEventNotifySound_VisibleChanged(object sender, EventArgs e)
1568 // SoundFileListup();
1571 //private void ComboBoxEventNotifySound_SelectedIndexChanged(object sender, EventArgs e)
1573 // if (_soundfileListup) return;
1575 // _MyEventSoundFile = (string)ComboBoxEventNotifySound.SelectedItem;
1578 private void OpenUrl(string url)
1580 string myPath = url;
1581 string path = this.ActionPanel.BrowserPathText.Text;
1584 if (!string.IsNullOrEmpty(BrowserPath))
1586 if (path.StartsWith("\"") && path.Length > 2 && path.IndexOf("\"", 2) > -1)
1588 int sep = path.IndexOf("\"", 2);
1589 string browserPath = path.Substring(1, sep - 1);
1591 if (sep < path.Length - 1)
1593 arg = path.Substring(sep + 1);
1595 myPath = arg + " " + myPath;
1596 System.Diagnostics.Process.Start(browserPath, myPath);
1600 System.Diagnostics.Process.Start(path, myPath);
1605 System.Diagnostics.Process.Start(myPath);
1610 // MessageBox.Show("ブラウザの起動に失敗、またはタイムアウトしました。" + ex.ToString());
1614 private void CreateAccountButton_Click(object sender, EventArgs e)
1616 this.OpenUrl("https://twitter.com/signup");
1619 public AppendSettingDialog()
1621 InitializeComponent();
1623 this.BasedPanel.StartAuthButton.Click += this.StartAuthButton_Click;
1624 this.BasedPanel.CreateAccountButton.Click += this.CreateAccountButton_Click;
1625 this.NotifyPanel.CheckEventNotify.CheckedChanged += this.CheckEventNotify_CheckedChanged;
1626 this.GetPeriodPanel.CheckPostAndGet.CheckedChanged += this.CheckPostAndGet_CheckedChanged;
1627 this.ActionPanel.UReadMng.CheckedChanged += this.UReadMng_CheckedChanged;
1628 this.FontPanel.btnUnread.Click += this.btnFontAndColor_Click;
1629 this.FontPanel.btnDetail.Click += this.btnFontAndColor_Click;
1630 this.FontPanel.btnListFont.Click += this.btnFontAndColor_Click;
1631 this.FontPanel.btnFav.Click += this.btnColor_Click;
1632 this.FontPanel.btnOWL.Click += this.btnColor_Click;
1633 this.FontPanel.btnRetweet.Click += this.btnColor_Click;
1634 this.FontPanel.btnDetailBack.Click += this.btnColor_Click;
1635 this.FontPanel.btnDetailLink.Click += this.btnColor_Click;
1636 this.FontPanel2.btnInputFont.Click += this.btnFontAndColor_Click;
1637 this.FontPanel2.btnSelf.Click += this.btnColor_Click;
1638 this.FontPanel2.btnAtSelf.Click += this.btnColor_Click;
1639 this.FontPanel2.btnTarget.Click += this.btnColor_Click;
1640 this.FontPanel2.btnAtTarget.Click += this.btnColor_Click;
1641 this.FontPanel2.btnAtFromTarget.Click += this.btnColor_Click;
1642 this.FontPanel2.btnInputBackcolor.Click += this.btnColor_Click;
1643 this.FontPanel2.btnAtTo.Click += this.btnColor_Click;
1644 this.FontPanel2.btnListBack.Click += this.btnColor_Click;
1646 this.Icon = Properties.Resources.MIcon;