OSDN Git Service

メソッドに式本体を使用する (IDE0021, IDE0022, IDE0025, IDE0027)
[opentween/open-tween.git] / OpenTween / Setting / Panel / TweetActPanel.cs
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) 2014      kim_upsilon (@kim_upsilon) <https://upsilo.net/~upsilon/>
8 // All rights reserved.
9 //
10 // This file is part of OpenTween.
11 //
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)
15 // any later version.
16 //
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
20 // for more details.
21 //
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.
26
27 using System;
28 using System.Collections.Generic;
29 using System.ComponentModel;
30 using System.Drawing;
31 using System.Data;
32 using System.Linq;
33 using System.Text;
34 using System.Windows.Forms;
35
36 namespace OpenTween.Setting.Panel
37 {
38     public partial class TweetActPanel : SettingPanelBase
39     {
40         public TweetActPanel()
41             => this.InitializeComponent();
42
43         public void LoadConfig(SettingCommon settingCommon, SettingLocal settingLocal)
44         {
45             this.StatusText.Text = settingLocal.StatusText;
46
47             if (settingCommon.PostCtrlEnter)
48             {
49                 this.ComboBoxPostKeySelect.SelectedIndex = 1;
50             }
51             else if (settingCommon.PostShiftEnter)
52             {
53                 this.ComboBoxPostKeySelect.SelectedIndex = 2;
54             }
55             else
56             {
57                 this.ComboBoxPostKeySelect.SelectedIndex = 0;
58             }
59
60             this.CheckUseRecommendStatus.Checked = settingLocal.UseRecommendStatus;
61             this.CheckRetweetNoConfirm.Checked = settingCommon.RetweetNoConfirm;
62             this.CheckAtIdSupple.Checked = settingCommon.UseAtIdSupplement;
63             this.CheckHashSupple.Checked = settingCommon.UseHashSupplement;
64             this.CheckAlphaPNGWorkaround.Checked = settingCommon.AlphaPNGWorkaround;
65         }
66
67         public void SaveConfig(SettingCommon settingCommon, SettingLocal settingLocal)
68         {
69             settingLocal.StatusText = this.StatusText.Text;
70
71             switch (this.ComboBoxPostKeySelect.SelectedIndex)
72             {
73                 case 2:
74                     settingCommon.PostShiftEnter = true;
75                     settingCommon.PostCtrlEnter = false;
76                     break;
77                 case 1:
78                     settingCommon.PostCtrlEnter = true;
79                     settingCommon.PostShiftEnter = false;
80                     break;
81                 case 0:
82                     settingCommon.PostCtrlEnter = false;
83                     settingCommon.PostShiftEnter = false;
84                     break;
85             }
86
87             settingLocal.UseRecommendStatus = this.CheckUseRecommendStatus.Checked;
88             settingCommon.RetweetNoConfirm = this.CheckRetweetNoConfirm.Checked;
89             settingCommon.UseAtIdSupplement = this.CheckAtIdSupple.Checked;
90             settingCommon.UseHashSupplement = this.CheckHashSupple.Checked;
91             settingCommon.AlphaPNGWorkaround = this.CheckAlphaPNGWorkaround.Checked;
92         }
93
94         private void CheckUseRecommendStatus_CheckedChanged(object sender, EventArgs e)
95         {
96             if (CheckUseRecommendStatus.Checked == true)
97             {
98                 StatusText.Enabled = false;
99             }
100             else
101             {
102                 StatusText.Enabled = true;
103             }
104         }
105     }
106 }