OSDN Git Service

プロパティ等の並び順を修正, コメントアウトされた不要な記述を除去
[opentween/open-tween.git] / OpenTween / AppendSettingDialog.cs
index 096a565..12ac13c 100644 (file)
@@ -45,18 +45,25 @@ namespace OpenTween
 {
     public partial class AppendSettingDialog : OTBaseForm
     {
-        private static AppendSettingDialog _instance = new AppendSettingDialog();
+        public event EventHandler<IntervalChangedEventArgs> IntervalChanged;
+
         internal Twitter tw;
 
         private bool _ValidationError = false;
-
         private long? InitialUserId;
+        private string _pin;
 
-        public TwitterConfiguration TwitterConfiguration = TwitterConfiguration.DefaultConfiguration();
+        public AppendSettingDialog()
+        {
+            this.InitializeComponent();
 
-        private string _pin;
+            this.BasedPanel.StartAuthButton.Click += this.StartAuthButton_Click;
+            this.BasedPanel.CreateAccountButton.Click += this.CreateAccountButton_Click;
+            this.GetPeriodPanel.CheckPostAndGet.CheckedChanged += this.CheckPostAndGet_CheckedChanged;
+            this.ActionPanel.UReadMng.CheckedChanged += this.UReadMng_CheckedChanged;
 
-        public event EventHandler<IntervalChangedEventArgs> IntervalChanged;
+            this.Icon = Properties.Resources.MIcon;
+        }
 
         public void LoadConfig(SettingCommon settingCommon, SettingLocal settingLocal)
         {
@@ -187,34 +194,6 @@ namespace OpenTween
             {
                 _ValidationError = false;
             }
-
-#if UA
-            //フォロー
-            if (this.FollowCheckBox.Checked)
-            {
-                //現在の設定内容で通信
-                HttpConnection.ProxyType ptype;
-                if (RadioProxyNone.Checked)
-                {
-                    ptype = HttpConnection.ProxyType.None;
-                }
-                else if (RadioProxyIE.Checked)
-                {
-                    ptype = HttpConnection.ProxyType.IE;
-                }
-                else
-                {
-                    ptype = HttpConnection.ProxyType.Specified;
-                }
-                string padr = TextProxyAddress.Text.Trim();
-                int pport = int.Parse(TextProxyPort.Text.Trim());
-                string pusr = TextProxyUser.Text.Trim();
-                string ppw = TextProxyPassword.Text.Trim();
-                HttpConnection.InitializeConnection(20, ptype, padr, pport, pusr, ppw);
-
-                string ret = tw.PostFollowCommand(ApplicationSettings.FeedbackTwitterName);
-            }
-#endif
         }
 
         private void Setting_FormClosing(object sender, FormClosingEventArgs e)
@@ -246,7 +225,6 @@ namespace OpenTween
             this.TreeViewSetting.Nodes["BasedNode"].Nodes["PeriodNode"].Tag = GetPeriodPanel;
             this.TreeViewSetting.Nodes["BasedNode"].Nodes["StartUpNode"].Tag = StartupPanel;
             this.TreeViewSetting.Nodes["BasedNode"].Nodes["GetCountNode"].Tag = GetCountPanel;
-            //this.TreeViewSetting.Nodes["BasedNode"].Nodes["UserStreamNode"].Tag = UserStreamPanel;
             this.TreeViewSetting.Nodes["ActionNode"].Tag = ActionPanel;
             this.TreeViewSetting.Nodes["ActionNode"].Nodes["TweetActNode"].Tag = TweetActPanel;
             this.TreeViewSetting.Nodes["PreviewNode"].Tag = PreviewPanel;
@@ -262,7 +240,6 @@ namespace OpenTween
             this.TreeViewSetting.SelectedNode = this.TreeViewSetting.Nodes[0];
             this.TreeViewSetting.ExpandAll();
 
-            //TreeViewSetting.SelectedNode = TreeViewSetting.TopNode;
             ActiveControl = BasedPanel.StartAuthButton;
         }
 
@@ -278,179 +255,6 @@ namespace OpenTween
             }
         }
 
-        private void btnFontAndColor_Click(object sender, EventArgs e) // Handles btnUnread.Click, btnDetail.Click, btnListFont.Click, btnInputFont.Click
-        {
-            Button Btn = (Button) sender;
-            DialogResult rtn;
-
-            FontDialog1.AllowVerticalFonts = false;
-            FontDialog1.AllowScriptChange = true;
-            FontDialog1.AllowSimulations = true;
-            FontDialog1.AllowVectorFonts = true;
-            FontDialog1.FixedPitchOnly = false;
-            FontDialog1.FontMustExist = true;
-            FontDialog1.ScriptsOnly = false;
-            FontDialog1.ShowApply = false;
-            FontDialog1.ShowEffects = true;
-            FontDialog1.ShowColor = true;
-
-            switch (Btn.Name)
-            {
-                case "btnUnread":
-                    FontDialog1.Color = this.FontPanel.lblUnread.ForeColor;
-                    FontDialog1.Font = this.FontPanel.lblUnread.Font;
-                    break;
-                case "btnDetail":
-                    FontDialog1.Color = this.FontPanel.lblDetail.ForeColor;
-                    FontDialog1.Font = this.FontPanel.lblDetail.Font;
-                    break;
-                case "btnListFont":
-                    FontDialog1.Color = this.FontPanel.lblListFont.ForeColor;
-                    FontDialog1.Font = this.FontPanel.lblListFont.Font;
-                    break;
-                case "btnInputFont":
-                    FontDialog1.Color = this.FontPanel2.lblInputFont.ForeColor;
-                    FontDialog1.Font = this.FontPanel2.lblInputFont.Font;
-                    break;
-            }
-
-            try
-            {
-                rtn = FontDialog1.ShowDialog();
-            }
-            catch(ArgumentException ex)
-            {
-                MessageBox.Show(ex.Message);
-                return;
-            }
-
-            if (rtn == DialogResult.Cancel) return;
-
-            switch (Btn.Name)
-            {
-                case "btnUnread":
-                    this.FontPanel.lblUnread.ForeColor = FontDialog1.Color;
-                    this.FontPanel.lblUnread.Font = FontDialog1.Font;
-                    break;
-                case "btnDetail":
-                    this.FontPanel.lblDetail.ForeColor = FontDialog1.Color;
-                    this.FontPanel.lblDetail.Font = FontDialog1.Font;
-                    break;
-                case "btnListFont":
-                    this.FontPanel.lblListFont.ForeColor = FontDialog1.Color;
-                    this.FontPanel.lblListFont.Font = FontDialog1.Font;
-                    break;
-                case "btnInputFont":
-                    this.FontPanel2.lblInputFont.ForeColor = FontDialog1.Color;
-                    this.FontPanel2.lblInputFont.Font = FontDialog1.Font;
-                    break;
-            }
-
-        }
-
-        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
-        {
-            Button Btn = (Button)sender;
-            DialogResult rtn;
-
-            ColorDialog1.AllowFullOpen = true;
-            ColorDialog1.AnyColor = true;
-            ColorDialog1.FullOpen = false;
-            ColorDialog1.SolidColorOnly = false;
-
-            switch (Btn.Name)
-            {
-                case "btnSelf":
-                    ColorDialog1.Color = this.FontPanel2.lblSelf.BackColor;
-                    break;
-                case "btnAtSelf":
-                    ColorDialog1.Color = this.FontPanel2.lblAtSelf.BackColor;
-                    break;
-                case "btnTarget":
-                    ColorDialog1.Color = this.FontPanel2.lblTarget.BackColor;
-                    break;
-                case "btnAtTarget":
-                    ColorDialog1.Color = this.FontPanel2.lblAtTarget.BackColor;
-                    break;
-                case "btnAtFromTarget":
-                    ColorDialog1.Color = this.FontPanel2.lblAtFromTarget.BackColor;
-                    break;
-                case "btnFav":
-                    ColorDialog1.Color = this.FontPanel.lblFav.ForeColor;
-                    break;
-                case "btnOWL":
-                    ColorDialog1.Color = this.FontPanel.lblOWL.ForeColor;
-                    break;
-                case "btnRetweet":
-                    ColorDialog1.Color = this.FontPanel.lblRetweet.ForeColor;
-                    break;
-                case "btnInputBackcolor":
-                    ColorDialog1.Color = this.FontPanel2.lblInputBackcolor.BackColor;
-                    break;
-                case "btnAtTo":
-                    ColorDialog1.Color = this.FontPanel2.lblAtTo.BackColor;
-                    break;
-                case "btnListBack":
-                    ColorDialog1.Color = this.FontPanel2.lblListBackcolor.BackColor;
-                    break;
-                case "btnDetailBack":
-                    ColorDialog1.Color = this.FontPanel.lblDetailBackcolor.BackColor;
-                    break;
-                case "btnDetailLink":
-                    ColorDialog1.Color = this.FontPanel.lblDetailLink.ForeColor;
-                    break;
-            }
-
-            rtn = ColorDialog1.ShowDialog();
-
-            if (rtn == DialogResult.Cancel) return;
-
-            switch (Btn.Name)
-            {
-                case "btnSelf":
-                    this.FontPanel2.lblSelf.BackColor = ColorDialog1.Color;
-                    break;
-                case "btnAtSelf":
-                    this.FontPanel2.lblAtSelf.BackColor = ColorDialog1.Color;
-                    break;
-                case "btnTarget":
-                    this.FontPanel2.lblTarget.BackColor = ColorDialog1.Color;
-                    break;
-                case "btnAtTarget":
-                    this.FontPanel2.lblAtTarget.BackColor = ColorDialog1.Color;
-                    break;
-                case "btnAtFromTarget":
-                    this.FontPanel2.lblAtFromTarget.BackColor = ColorDialog1.Color;
-                    break;
-                case "btnFav":
-                    this.FontPanel.lblFav.ForeColor = ColorDialog1.Color;
-                    break;
-                case "btnOWL":
-                    this.FontPanel.lblOWL.ForeColor = ColorDialog1.Color;
-                    break;
-                case "btnRetweet":
-                    this.FontPanel.lblRetweet.ForeColor = ColorDialog1.Color;
-                    break;
-                case "btnInputBackcolor":
-                    this.FontPanel2.lblInputBackcolor.BackColor = ColorDialog1.Color;
-                    break;
-                case "btnAtTo":
-                    this.FontPanel2.lblAtTo.BackColor = ColorDialog1.Color;
-                    break;
-                case "btnListBack":
-                    this.FontPanel2.lblListBackcolor.BackColor = ColorDialog1.Color;
-                    break;
-                case "btnDetailBack":
-                    this.FontPanel.lblDetailBackcolor.BackColor = ColorDialog1.Color;
-                    break;
-                case "btnDetailLink":
-                    this.FontPanel.lblDetailLink.ForeColor = ColorDialog1.Color;
-                    break;
-            }
-        }
-
-        public string RecommendStatusText { get; set; }
-
         private bool StartAuth()
         {
             //現在の設定内容で通信
@@ -477,8 +281,6 @@ namespace OpenTween
             Networking.SetWebProxy(ptype, padr, pport, pusr, ppw);
             HttpTwitter.TwitterUrl = this.ConnectionPanel.TwitterAPIText.Text.Trim();
             tw.Initialize("", "", "", 0);
-            //this.AuthStateLabel.Text = Properties.Resources.AuthorizeButton_Click4;
-            //this.AuthUserLabel.Text = "";
             string pinPageUrl = "";
             string rslt = tw.StartAuthentication(ref pinPageUrl);
             if (string.IsNullOrEmpty(rslt))
@@ -509,8 +311,6 @@ namespace OpenTween
             if (string.IsNullOrEmpty(rslt))
             {
                 MessageBox.Show(Properties.Resources.AuthorizeButton_Click1, "Authenticate", MessageBoxButtons.OK);
-                //this.AuthStateLabel.Text = Properties.Resources.AuthorizeButton_Click3;
-                //this.AuthUserLabel.Text = tw.Username;
                 int idx = -1;
                 UserAccount user = new UserAccount();
                 user.Username = tw.Username;
@@ -536,33 +336,21 @@ namespace OpenTween
                 {
                     this.BasedPanel.AuthUserCombo.SelectedIndex = this.BasedPanel.AuthUserCombo.Items.Add(user);
                 }
-                //if (TwitterApiInfo.AccessLevel = ApiAccessLevel.ReadWrite)
-                //{
-                //    this.AuthStateLabel.Text += "(xAuth)";
-                //}
-                //else if (TwitterApiInfo.AccessLevel == ApiAccessLevel.ReadWriteAndDirectMessage)
-                //{
-                //    this.AuthStateLabel.Text += "(OAuth)";
-                //}
                 return true;
             }
             else
             {
                 MessageBox.Show(Properties.Resources.AuthorizeButton_Click2 + Environment.NewLine + rslt, "Authenticate", MessageBoxButtons.OK);
-                //this.AuthStateLabel.Text = Properties.Resources.AuthorizeButton_Click4;
-                //this.AuthUserLabel.Text = "";
                 return false;
             }
         }
 
         private void StartAuthButton_Click(object sender, EventArgs e)
         {
-            //this.Save.Enabled = false;
             if (StartAuth())
             {
                 if (PinAuth())
                 {
-                    //this.Save.Enabled = true;
                 }
             }
         }
@@ -585,11 +373,6 @@ namespace OpenTween
             this.GetPeriodPanel.LabelUserStreamActive.Visible = tw.UserStreamEnabled;
         }
 
-        public static AppendSettingDialog Instance
-        {
-            get { return _instance; }
-        }
-
         private bool BitlyValidation(string id, string apikey)
         {
             if (string.IsNullOrEmpty(id) || string.IsNullOrEmpty(apikey))
@@ -630,44 +413,6 @@ namespace OpenTween
             _ValidationError = false;
         }
 
-        //private void CheckEventNotify_CheckedChanged(object sender, EventArgs e)
-        //                Handles CheckEventNotify.CheckedChanged, CheckFavoritesEvent.CheckStateChanged,
-        //                        CheckUnfavoritesEvent.CheckStateChanged, CheckFollowEvent.CheckStateChanged,
-        //                        CheckListMemberAddedEvent.CheckStateChanged, CheckListMemberRemovedEvent.CheckStateChanged,
-        //                        CheckListCreatedEvent.CheckStateChanged, CheckUserUpdateEvent.CheckStateChanged
-        //{
-        //    EventNotifyEnabled = CheckEventNotify.Checked;
-        //    GetEventNotifyFlag(EventNotifyFlag, IsMyEventNotifyFlag);
-        //    ApplyEventNotifyFlag(EventNotifyEnabled, EventNotifyFlag, IsMyEventNotifyFlag);
-        //}
-
-        //private void CheckForceEventNotify_CheckedChanged(object sender, EventArgs e)
-        //{
-        //    _MyForceEventNotify = CheckEventNotify.Checked;
-        //}
-
-        //private void CheckFavEventUnread_CheckedChanged(object sender, EventArgs e)
-        //{
-        //    _MyFavEventUnread = CheckFavEventUnread.Checked;
-        //}
-
-        //private void ComboBoxTranslateLanguage_SelectedIndexChanged(object sender, EventArgs e)
-        //{
-        //    _MyTranslateLanguage = (new Google()).GetLanguageEnumFromIndex(ComboBoxTranslateLanguage.SelectedIndex);
-        //}
-
-        //private void ComboBoxEventNotifySound_VisibleChanged(object sender, EventArgs e)
-        //{
-        //    SoundFileListup();
-        //}
-
-        //private void ComboBoxEventNotifySound_SelectedIndexChanged(object sender, EventArgs e)
-        //{
-        //   if (_soundfileListup) return;
-
-        //    _MyEventSoundFile = (string)ComboBoxEventNotifySound.SelectedItem;
-        //}
-
         private void OpenUrl(string url)
         {
             string myPath = url;
@@ -700,7 +445,6 @@ namespace OpenTween
             }
             catch(Exception)
             {
-//              MessageBox.Show("ブラウザの起動に失敗、またはタイムアウトしました。" + ex.ToString());
             }
         }
 
@@ -709,35 +453,6 @@ namespace OpenTween
             this.OpenUrl("https://twitter.com/signup");
         }
 
-        public AppendSettingDialog()
-        {
-            InitializeComponent();
-
-            this.BasedPanel.StartAuthButton.Click += this.StartAuthButton_Click;
-            this.BasedPanel.CreateAccountButton.Click += this.CreateAccountButton_Click;
-            this.GetPeriodPanel.CheckPostAndGet.CheckedChanged += this.CheckPostAndGet_CheckedChanged;
-            this.ActionPanel.UReadMng.CheckedChanged += this.UReadMng_CheckedChanged;
-            this.FontPanel.btnUnread.Click += this.btnFontAndColor_Click;
-            this.FontPanel.btnDetail.Click += this.btnFontAndColor_Click;
-            this.FontPanel.btnListFont.Click += this.btnFontAndColor_Click;
-            this.FontPanel.btnFav.Click += this.btnColor_Click;
-            this.FontPanel.btnOWL.Click += this.btnColor_Click;
-            this.FontPanel.btnRetweet.Click += this.btnColor_Click;
-            this.FontPanel.btnDetailBack.Click += this.btnColor_Click;
-            this.FontPanel.btnDetailLink.Click += this.btnColor_Click;
-            this.FontPanel2.btnInputFont.Click += this.btnFontAndColor_Click;
-            this.FontPanel2.btnSelf.Click += this.btnColor_Click;
-            this.FontPanel2.btnAtSelf.Click += this.btnColor_Click;
-            this.FontPanel2.btnTarget.Click += this.btnColor_Click;
-            this.FontPanel2.btnAtTarget.Click += this.btnColor_Click;
-            this.FontPanel2.btnAtFromTarget.Click += this.btnColor_Click;
-            this.FontPanel2.btnInputBackcolor.Click += this.btnColor_Click;
-            this.FontPanel2.btnAtTo.Click += this.btnColor_Click;
-            this.FontPanel2.btnListBack.Click += this.btnColor_Click;
-
-            this.Icon = Properties.Resources.MIcon;
-        }
-
         private void GetPeriodPanel_IntervalChanged(object sender, IntervalChangedEventArgs e)
         {
             if (this.IntervalChanged != null)