OSDN Git Service

ConnectionPanelに対する設定値の設定・取得を LoadConfing/SaveConfig メソッドに移動
authorKimura Youichi <kim.upsilon@bucyou.net>
Tue, 29 Jul 2014 14:28:34 +0000 (23:28 +0900)
committerKimura Youichi <kim.upsilon@bucyou.net>
Thu, 31 Jul 2014 16:17:11 +0000 (01:17 +0900)
OpenTween/AppendSettingDialog.cs
OpenTween/Setting/Panel/ConnectionPanel.cs
OpenTween/Tween.cs

index b85e37c..5690583 100644 (file)
@@ -76,6 +76,7 @@ namespace OpenTween
             this.ShortUrlPanel.LoadConfig(settingCommon);
             this.ProxyPanel.LoadConfig(settingLocal);
             this.CooperatePanel.LoadConfig(settingCommon);
+            this.ConnectionPanel.LoadConfig(settingCommon);
         }
 
         public void SaveConfig(SettingCommon settingCommon, SettingLocal settingLocal)
@@ -92,6 +93,7 @@ namespace OpenTween
             this.ShortUrlPanel.SaveConfig(settingCommon);
             this.ProxyPanel.SaveConfig(settingLocal);
             this.CooperatePanel.SaveConfig(settingCommon);
+            this.ConnectionPanel.SaveConfig(settingCommon);
         }
 
         private void TreeViewSetting_BeforeSelect(object sender, TreeViewCancelEventArgs e)
@@ -217,13 +219,11 @@ namespace OpenTween
 #endif
             try
             {
-                DefaultTimeOut = int.Parse(this.ConnectionPanel.ConnectionTimeOut.Text);
                 EventNotifyEnabled = this.NotifyPanel.CheckEventNotify.Checked;
                 GetEventNotifyFlag(ref _MyEventNotifyFlag, ref _isMyEventNotifyFlag);
                 ForceEventNotify = this.NotifyPanel.CheckForceEventNotify.Checked;
                 FavEventUnread = this.NotifyPanel.CheckFavEventUnread.Checked;
                 EventSoundFile = (string)this.NotifyPanel.ComboBoxEventNotifySound.SelectedItem;
-                TwitterApiUrl = this.ConnectionPanel.TwitterAPIText.Text.Trim();
                 this.IsRemoveSameEvent = this.NotifyPanel.IsRemoveSameFavEventCheckBox.Checked;
             }
             catch(Exception)
@@ -331,13 +331,10 @@ namespace OpenTween
                 }
             }
 
-            this.ConnectionPanel.ConnectionTimeOut.Text = DefaultTimeOut.ToString();
-
             ApplyEventNotifyFlag(EventNotifyEnabled, EventNotifyFlag, IsMyEventNotifyFlag);
             this.NotifyPanel.CheckForceEventNotify.Checked = ForceEventNotify;
             this.NotifyPanel.CheckFavEventUnread.Checked = FavEventUnread;
             SoundFileListup();
-            this.ConnectionPanel.TwitterAPIText.Text = TwitterApiUrl;
 
             this.NotifyPanel.IsRemoveSameFavEventCheckBox.Checked = this.IsRemoveSameEvent;
 
@@ -550,9 +547,6 @@ namespace OpenTween
 
         public string RecommendStatusText { get; set; }
 
-        public int DefaultTimeOut { get; set; }
-        public string TwitterApiUrl { get; set; }
-
         public bool EventNotifyEnabled { get; set; }
 
         public MyCommon.EVENTTYPE EventNotifyFlag
index 6584839..a9d3642 100644 (file)
@@ -42,6 +42,18 @@ namespace OpenTween.Setting.Panel
             InitializeComponent();
         }
 
+        public void LoadConfig(SettingCommon settingCommon)
+        {
+            this.ConnectionTimeOut.Text = settingCommon.DefaultTimeOut.ToString();
+            this.TwitterAPIText.Text = settingCommon.TwitterUrl;
+        }
+
+        public void SaveConfig(SettingCommon settingCommon)
+        {
+            settingCommon.DefaultTimeOut = int.Parse(this.ConnectionTimeOut.Text);
+            settingCommon.TwitterUrl = this.TwitterAPIText.Text.Trim();
+        }
+
         private void ConnectionTimeOut_Validating(object sender, CancelEventArgs e)
         {
             int tm;
index e544f56..43a8558 100644 (file)
@@ -760,7 +760,6 @@ namespace OpenTween
             //設定画面への反映
             this.SettingDialog.LoadConfig(this._cfgCommon, this._cfgLocal);
             HttpTwitter.TwitterUrl = _cfgCommon.TwitterUrl;
-            SettingDialog.TwitterApiUrl = _cfgCommon.TwitterUrl;
 
             //認証関連
             if (string.IsNullOrEmpty(_cfgCommon.Token)) _cfgCommon.UserName = "";
@@ -775,7 +774,6 @@ namespace OpenTween
             this.PlaySoundMenuItem.Checked = this._cfgCommon.PlaySound;
             this.PlaySoundFileMenuItem.Checked = this._cfgCommon.PlaySound;
 
-            SettingDialog.DefaultTimeOut = _cfgCommon.DefaultTimeOut;
             SettingDialog.EventNotifyEnabled = _cfgCommon.EventNotifyEnabled;
             SettingDialog.EventNotifyFlag = _cfgCommon.EventNotifyFlag;
             SettingDialog.IsMyEventNotifyFlag = _cfgCommon.IsMyEventNotifyFlag;
@@ -893,7 +891,7 @@ namespace OpenTween
             }
 
             //Twitter用通信クラス初期化
-            Networking.DefaultTimeout = TimeSpan.FromSeconds(this.SettingDialog.DefaultTimeOut);
+            Networking.DefaultTimeout = TimeSpan.FromSeconds(this._cfgCommon.DefaultTimeOut);
             Networking.SetWebProxy(this._cfgLocal.ProxyType,
                 this._cfgLocal.ProxyAddress, this._cfgLocal.ProxyPort,
                 this._cfgLocal.ProxyUser, this._cfgLocal.ProxyPassword);
@@ -3806,7 +3804,7 @@ namespace OpenTween
                     ShortUrl.Instance.BitlyKey = this._cfgCommon.BitlyPwd;
                     HttpTwitter.TwitterUrl = _cfgCommon.TwitterUrl;
 
-                    Networking.DefaultTimeout = TimeSpan.FromSeconds(this.SettingDialog.DefaultTimeOut);
+                    Networking.DefaultTimeout = TimeSpan.FromSeconds(this._cfgCommon.DefaultTimeOut);
                     Networking.SetWebProxy(this._cfgLocal.ProxyType,
                         this._cfgLocal.ProxyAddress, this._cfgLocal.ProxyPort,
                         this._cfgLocal.ProxyUser, this._cfgLocal.ProxyPassword);
@@ -7643,7 +7641,6 @@ namespace OpenTween
                 _cfgCommon.TokenSecret = tw.AccessTokenSecret;
                 _cfgCommon.UserAccounts = SettingDialog.UserAccounts;
 
-                _cfgCommon.DefaultTimeOut = SettingDialog.DefaultTimeOut;
                 _cfgCommon.EventNotifyEnabled = SettingDialog.EventNotifyEnabled;
                 _cfgCommon.EventNotifyFlag = SettingDialog.EventNotifyFlag;
                 _cfgCommon.IsMyEventNotifyFlag = SettingDialog.IsMyEventNotifyFlag;
@@ -7688,7 +7685,6 @@ namespace OpenTween
                 _cfgCommon.HashIsHead = HashMgr.IsHead;
                 _cfgCommon.HashIsPermanent = HashMgr.IsPermanent;
                 _cfgCommon.HashIsNotAddToAtReply = HashMgr.IsNotAddToAtReply;
-                _cfgCommon.TwitterUrl = SettingDialog.TwitterApiUrl;
                 if (ToolStripFocusLockMenuItem != null &&
                         ToolStripFocusLockMenuItem.IsDisposed == false)
                 {