private void Save_Click(object sender, EventArgs e) { if (MyCommon.IsNetworkAvailable() && (ComboBoxAutoShortUrlFirst.SelectedIndex == (int)UrlConverter.Bitly || ComboBoxAutoShortUrlFirst.SelectedIndex == (int)UrlConverter.Jmp) && (!string.IsNullOrEmpty(TextBitlyId.Text) || !string.IsNullOrEmpty(TextBitlyPw.Text))) { if (!BitlyValidation(TextBitlyId.Text, TextBitlyPw.Text)) { MessageBox.Show(R.SettingSave_ClickText1); _validationError = true; TreeViewSetting.SelectedNode.Name = "TweetActNode"; // 動作タブを選択 TextBitlyId.Focus(); return; } } _validationError = false; _configurations.UserAccounts.Clear(); _configurations.UserAccounts.AddRange(AuthUserCombo.Items.Cast<UserAccount>()); if (AuthUserCombo.SelectedIndex < 0) { _tw.ClearAuthInfo(); _tw.Initialize(string.Empty, string.Empty, string.Empty, 0); } else { string selectedUser = ((UserAccount)AuthUserCombo.SelectedItem).Username.ToLower(); var newuser = _configurations.UserAccounts.First(u => u.Username.ToLower() == selectedUser); _tw.Initialize(newuser.Token, newuser.TokenSecret, newuser.Username, newuser.UserId); if (newuser.UserId == 0) { _tw.VerifyCredentials(); newuser.UserId = _tw.UserId; } } try { _configurations.UserstreamStartup = StartupUserstreamCheck.Checked; var arg = new IntervalChangedEventArgs(); bool isIntervalChanged = SaveIntarvals(arg); if (isIntervalChanged) { if (IntervalChanged != null) { IntervalChanged(this, arg); } } _configurations.Readed = StartupReaded.Checked; _configurations.IconSz = IconSize.SelectedIndex < 0 ? IconSizes.IconNone : (IconSizes)IconSize.SelectedIndex; _configurations.Status = StatusText.Text; _configurations.PlaySound = PlaySnd.Checked; _configurations.UnreadManage = UReadMng.Checked; _configurations.OneWayLove = OneWayLv.Checked; _configurations.FontUnread = lblUnread.Font; // 未使用 _configurations.ColorUnread = lblUnread.ForeColor; _configurations.FontReaded = lblListFont.Font; // リストフォントとして使用 _configurations.ColorReaded = lblListFont.ForeColor; _configurations.ColorFav = lblFav.ForeColor; _configurations.ColorOWL = lblOWL.ForeColor; _configurations.ColorRetweet = lblRetweet.ForeColor; _configurations.FontDetail = lblDetail.Font; _configurations.ColorSelf = lblSelf.BackColor; _configurations.ColorAtSelf = lblAtSelf.BackColor; _configurations.ColorTarget = lblTarget.BackColor; _configurations.ColorAtTarget = lblAtTarget.BackColor; _configurations.ColorAtFromTarget = lblAtFromTarget.BackColor; _configurations.ColorAtTo = lblAtTo.BackColor; _configurations.ColorInputBackcolor = lblInputBackcolor.BackColor; _configurations.ColorInputFont = lblInputFont.ForeColor; _configurations.ColorListBackcolor = lblListBackcolor.BackColor; _configurations.ColorDetailBackcolor = lblDetailBackcolor.BackColor; _configurations.ColorDetail = lblDetail.ForeColor; _configurations.ColorDetailLink = lblDetailLink.ForeColor; _configurations.FontInputFont = lblInputFont.Font; switch (cmbNameBalloon.SelectedIndex) { case 0: _configurations.NameBalloon = NameBalloonEnum.None; break; case 1: _configurations.NameBalloon = NameBalloonEnum.UserID; break; case 2: _configurations.NameBalloon = NameBalloonEnum.NickName; break; } switch (ComboBoxPostKeySelect.SelectedIndex) { case 2: _configurations.PostShiftEnter = true; _configurations.PostCtrlEnter = false; break; case 1: _configurations.PostCtrlEnter = true; _configurations.PostShiftEnter = false; break; case 0: _configurations.PostCtrlEnter = false; _configurations.PostShiftEnter = false; break; } _configurations.CountApi = Convert.ToInt32(TextCountApi.Text); _configurations.CountApiReply = Convert.ToInt32(TextCountApiReply.Text); _configurations.BrowserPath = BrowserPathText.Text.Trim(); _configurations.PostAndGet = CheckPostAndGet.Checked; _configurations.UseRecommendStatus = CheckUseRecommendStatus.Checked; _configurations.DispUsername = CheckDispUsername.Checked; _configurations.CloseToExit = CheckCloseToExit.Checked; _configurations.MinimizeToTray = CheckMinimizeToTray.Checked; switch (ComboDispTitle.SelectedIndex) { case 0: // None _configurations.DispLatestPost = DispTitleEnum.None; break; case 1: // Ver _configurations.DispLatestPost = DispTitleEnum.Ver; break; case 2: // Post _configurations.DispLatestPost = DispTitleEnum.Post; break; case 3: // RepCount _configurations.DispLatestPost = DispTitleEnum.UnreadRepCount; break; case 4: // AllCount _configurations.DispLatestPost = DispTitleEnum.UnreadAllCount; break; case 5: // Rep+All _configurations.DispLatestPost = DispTitleEnum.UnreadAllRepCount; break; case 6: // Unread/All _configurations.DispLatestPost = DispTitleEnum.UnreadCountAllCount; break; case 7: // Count of Status/Follow/Follower _configurations.DispLatestPost = DispTitleEnum.OwnStatus; break; } _configurations.SortOrderLock = CheckSortOrderLock.Checked; _configurations.TinyUrlResolve = CheckTinyURL.Checked; _configurations.ShortUrlForceResolve = CheckForceResolve.Checked; ShortUrl.IsResolve = _configurations.TinyUrlResolve; ShortUrl.IsForceResolve = _configurations.ShortUrlForceResolve; if (RadioProxyNone.Checked) { _configurations.SelectedProxyType = HttpConnection.ProxyType.None; } else if (RadioProxyIE.Checked) { _configurations.SelectedProxyType = HttpConnection.ProxyType.IE; } else { _configurations.SelectedProxyType = HttpConnection.ProxyType.Specified; } _configurations.ProxyAddress = TextProxyAddress.Text.Trim(); _configurations.ProxyPort = int.Parse(TextProxyPort.Text.Trim()); _configurations.ProxyUser = TextProxyUser.Text.Trim(); _configurations.ProxyPassword = TextProxyPassword.Text.Trim(); _configurations.PeriodAdjust = CheckPeriodAdjust.Checked; _configurations.StartupVersion = CheckStartupVersion.Checked; _configurations.StartupFollowers = CheckStartupFollowers.Checked; _configurations.RestrictFavCheck = CheckFavRestrict.Checked; _configurations.AlwaysTop = CheckAlwaysTop.Checked; _configurations.UrlConvertAuto = CheckAutoConvertUrl.Checked; _configurations.ShortenTco = ShortenTcoCheck.Checked; _configurations.OutputzEnabled = CheckOutputz.Checked; _configurations.OutputzKey = TextBoxOutputzKey.Text.Trim(); switch (ComboBoxOutputzUrlmode.SelectedIndex) { case 0: _configurations.OutputzUrlmode = OutputzUrlmode.twittercom; break; case 1: _configurations.OutputzUrlmode = OutputzUrlmode.twittercomWithUsername; break; } _configurations.Nicoms = CheckNicoms.Checked; _configurations.UseUnreadStyle = chkUnreadStyle.Checked; _configurations.DateTimeFormat = CmbDateTimeFormat.Text; _configurations.DefaultTimeOut = Convert.ToInt32(ConnectionTimeOut.Text); _configurations.RetweetNoConfirm = CheckRetweetNoConfirm.Checked; _configurations.LimitBalloon = CheckBalloonLimit.Checked; _configurations.EventNotifyEnabled = CheckEventNotify.Checked; { var m = _configurations.EventNotifyFlag; var i = _configurations.IsMyEventNotifyFlag; GetEventNotifyFlag(ref m, ref i); _configurations.EventNotifyFlag = m; _configurations.IsMyEventNotifyFlag = i; } _configurations.ForceEventNotify = CheckForceEventNotify.Checked; _configurations.FavEventUnread = CheckFavEventUnread.Checked; _configurations.TranslateLanguage = (new Bing()).GetLanguageEnumFromIndex(ComboBoxTranslateLanguage.SelectedIndex); _configurations.EventSoundFile = Convert.ToString(ComboBoxEventNotifySound.SelectedItem); _configurations.AutoShortUrlFirst = (UrlConverter)ComboBoxAutoShortUrlFirst.SelectedIndex; _configurations.TabIconDisp = CheckTabIconDisp.Checked; _configurations.ReadOwnPost = chkReadOwnPost.Checked; _configurations.GetFav = CheckGetFav.Checked; _configurations.IsMonospace = CheckMonospace.Checked; _configurations.ReadOldPosts = CheckReadOldPosts.Checked; _configurations.UseSsl = CheckUseSsl.Checked; _configurations.BitlyUser = TextBitlyId.Text; _configurations.BitlyPwd = TextBitlyPw.Text; _configurations.ShowGrid = CheckShowGrid.Checked; _configurations.UseAtIdSupplement = CheckAtIdSupple.Checked; _configurations.UseHashSupplement = CheckHashSupple.Checked; _configurations.PreviewEnable = CheckPreviewEnable.Checked; _configurations.TwitterApiUrl = TwitterAPIText.Text.Trim(); _configurations.TwitterSearchApiUrl = TwitterSearchAPIText.Text.Trim(); switch (ReplyIconStateCombo.SelectedIndex) { case 0: _configurations.ReplyIconState = ReplyIconState.None; break; case 1: _configurations.ReplyIconState = ReplyIconState.StaticIcon; break; case 2: _configurations.ReplyIconState = ReplyIconState.BlinkIcon; break; } var lngs = new[] { "OS", "ja", "en", "zh-CN" }; _configurations.Language = LanguageCombo.SelectedIndex < 0 || LanguageCombo.SelectedIndex > lngs.Length ? "en" : lngs[LanguageCombo.SelectedIndex]; _configurations.HotkeyEnabled = HotkeyCheck.Checked; _configurations.HotkeyMod = Keys.None; if (HotkeyAlt.Checked) { _configurations.HotkeyMod = _configurations.HotkeyMod | Keys.Alt; } if (HotkeyShift.Checked) { _configurations.HotkeyMod = _configurations.HotkeyMod | Keys.Shift; } if (HotkeyCtrl.Checked) { _configurations.HotkeyMod = _configurations.HotkeyMod | Keys.Control; } if (HotkeyWin.Checked) { _configurations.HotkeyMod = _configurations.HotkeyMod | Keys.LWin; } { int tmp; if (int.TryParse(HotkeyCode.Text, out tmp)) { _configurations.HotkeyValue = tmp; } } _configurations.HotkeyKey = (Keys)HotkeyText.Tag; _configurations.BlinkNewMentions = CheckNewMentionsBlink.Checked; _configurations.UseAdditionalCount = UseChangeGetCount.Checked; _configurations.MoreCountApi = Convert.ToInt32(GetMoreTextCountApi.Text); _configurations.FirstCountApi = Convert.ToInt32(FirstTextCountApi.Text); _configurations.SearchCountApi = Convert.ToInt32(SearchTextCountApi.Text); _configurations.FavoritesCountApi = Convert.ToInt32(FavoritesTextCountApi.Text); _configurations.UserTimelineCountApi = Convert.ToInt32(UserTimelineTextCountApi.Text); _configurations.ListCountApi = Convert.ToInt32(ListTextCountApi.Text); _configurations.OpenUserTimeline = CheckOpenUserTimeline.Checked; _configurations.ListDoubleClickAction = ListDoubleClickActionComboBox.SelectedIndex; _configurations.UserAppointUrl = UserAppointUrlText.Text; _configurations.HideDuplicatedRetweets = HideDuplicatedRetweetsCheck.Checked; _configurations.IsPreviewFoursquare = IsPreviewFoursquareCheckBox.Checked; _configurations.FoursquarePreviewHeight = Convert.ToInt32(FoursquarePreviewHeightTextBox.Text); _configurations.FoursquarePreviewWidth = Convert.ToInt32(FoursquarePreviewWidthTextBox.Text); _configurations.FoursquarePreviewZoom = Convert.ToInt32(FoursquarePreviewZoomTextBox.Text); _configurations.IsListStatusesIncludeRts = IsListsIncludeRtsCheckBox.Checked; _configurations.TabMouseLock = TabMouseLockCheck.Checked; _configurations.IsRemoveSameEvent = IsRemoveSameFavEventCheckBox.Checked; _configurations.IsNotifyUseGrowl = IsNotifyUseGrowlCheckBox.Checked; } catch (Exception) { MessageBox.Show(R.Save_ClickText3); DialogResult = DialogResult.Cancel; } }
private void TimerInterval_Changed(object sender, IntervalChangedEventArgs e) { if (!_timerTimeline.Enabled) { return; } _resetTimers = e; }
private bool SaveIntarvals(IntervalChangedEventArgs arg) { if (_configurations.UserstreamPeriodInt != Convert.ToInt32(UserstreamPeriod.Text)) { _configurations.UserstreamPeriodInt = Convert.ToInt32(UserstreamPeriod.Text); arg.UserStream = true; } if (_configurations.TimelinePeriodInt != Convert.ToInt32(TimelinePeriod.Text)) { _configurations.TimelinePeriodInt = Convert.ToInt32(TimelinePeriod.Text); arg.Timeline = true; } if (_configurations.DMPeriodInt != Convert.ToInt32(DMPeriod.Text)) { _configurations.DMPeriodInt = Convert.ToInt32(DMPeriod.Text); arg.DirectMessage = true; } if (_configurations.PubSearchPeriodInt != Convert.ToInt32(PubSearchPeriod.Text)) { _configurations.PubSearchPeriodInt = Convert.ToInt32(PubSearchPeriod.Text); arg.PublicSearch = true; } if (_configurations.ListsPeriodInt != Convert.ToInt32(ListsPeriod.Text)) { _configurations.ListsPeriodInt = Convert.ToInt32(ListsPeriod.Text); arg.Lists = true; } if (_configurations.ReplyPeriodInt != Convert.ToInt32(ReplyPeriod.Text)) { _configurations.ReplyPeriodInt = Convert.ToInt32(ReplyPeriod.Text); arg.Reply = true; } if (_configurations.UserTimelinePeriodInt != Convert.ToInt32(UserTimelinePeriod.Text)) { _configurations.UserTimelinePeriodInt = Convert.ToInt32(UserTimelinePeriod.Text); arg.UserTimeline = true; } return arg.UserStream || arg.Timeline || arg.DirectMessage || arg.PublicSearch || arg.Lists || arg.Reply || arg.UserTimeline; }