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.
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.
30 using System.Collections.Generic;
31 using System.ComponentModel;
36 using System.Windows.Forms;
38 namespace OpenTween.Setting.Panel
40 public partial class GetCountPanel : SettingPanelBase
42 public GetCountPanel()
43 => this.InitializeComponent();
45 public void LoadConfig(SettingCommon settingCommon)
47 this.TextCountApi.Text = settingCommon.CountApi.ToString();
48 this.TextCountApiReply.Text = settingCommon.CountApiReply.ToString();
49 this.GetMoreTextCountApi.Text = settingCommon.MoreCountApi.ToString();
50 this.FirstTextCountApi.Text = settingCommon.FirstCountApi.ToString();
51 this.SearchTextCountApi.Text = settingCommon.SearchCountApi.ToString();
52 this.FavoritesTextCountApi.Text = settingCommon.FavoritesCountApi.ToString();
53 this.UserTimelineTextCountApi.Text = settingCommon.UserTimelineCountApi.ToString();
54 this.ListTextCountApi.Text = settingCommon.ListCountApi.ToString();
55 this.UseChangeGetCount.Checked = settingCommon.UseAdditionalCount;
57 this.Label28.Enabled = this.UseChangeGetCount.Checked;
58 this.Label30.Enabled = this.UseChangeGetCount.Checked;
59 this.Label53.Enabled = this.UseChangeGetCount.Checked;
60 this.Label66.Enabled = this.UseChangeGetCount.Checked;
61 this.Label17.Enabled = this.UseChangeGetCount.Checked;
62 this.Label25.Enabled = this.UseChangeGetCount.Checked;
63 this.GetMoreTextCountApi.Enabled = this.UseChangeGetCount.Checked;
64 this.FirstTextCountApi.Enabled = this.UseChangeGetCount.Checked;
65 this.SearchTextCountApi.Enabled = this.UseChangeGetCount.Checked;
66 this.FavoritesTextCountApi.Enabled = this.UseChangeGetCount.Checked;
67 this.UserTimelineTextCountApi.Enabled = this.UseChangeGetCount.Checked;
68 this.ListTextCountApi.Enabled = this.UseChangeGetCount.Checked;
71 public void SaveConfig(SettingCommon settingCommon)
73 settingCommon.CountApi = int.Parse(this.TextCountApi.Text);
74 settingCommon.CountApiReply = int.Parse(this.TextCountApiReply.Text);
75 settingCommon.UseAdditionalCount = this.UseChangeGetCount.Checked;
76 settingCommon.MoreCountApi = int.Parse(this.GetMoreTextCountApi.Text);
77 settingCommon.FirstCountApi = int.Parse(this.FirstTextCountApi.Text);
78 settingCommon.SearchCountApi = int.Parse(this.SearchTextCountApi.Text);
79 settingCommon.FavoritesCountApi = int.Parse(this.FavoritesTextCountApi.Text);
80 settingCommon.UserTimelineCountApi = int.Parse(this.UserTimelineTextCountApi.Text);
81 settingCommon.ListCountApi = int.Parse(this.ListTextCountApi.Text);
84 private void TextCountApi_Validating(object sender, CancelEventArgs e)
89 cnt = int.Parse(TextCountApi.Text);
93 MessageBox.Show(Properties.Resources.TextCountApi_Validating1);
98 if (!Twitter.VerifyApiResultCount(MyCommon.WORKERTYPE.Timeline, cnt))
100 MessageBox.Show(Properties.Resources.TextCountApi_Validating1);
106 private void TextCountApiReply_Validating(object sender, CancelEventArgs e)
111 cnt = int.Parse(TextCountApiReply.Text);
115 MessageBox.Show(Properties.Resources.TextCountApi_Validating1);
120 if (!Twitter.VerifyApiResultCount(MyCommon.WORKERTYPE.Reply, cnt))
122 MessageBox.Show(Properties.Resources.TextCountApi_Validating1);
128 private void GetMoreTextCountApi_Validating(object sender, CancelEventArgs e)
133 cnt = int.Parse(GetMoreTextCountApi.Text);
137 MessageBox.Show(Properties.Resources.TextCountApi_Validating1);
142 if (cnt != 0 && !Twitter.VerifyMoreApiResultCount(cnt))
144 MessageBox.Show(Properties.Resources.TextCountApi_Validating1);
150 private void UseChangeGetCount_CheckedChanged(object sender, EventArgs e)
152 GetMoreTextCountApi.Enabled = UseChangeGetCount.Checked;
153 FirstTextCountApi.Enabled = UseChangeGetCount.Checked;
154 Label28.Enabled = UseChangeGetCount.Checked;
155 Label30.Enabled = UseChangeGetCount.Checked;
156 Label53.Enabled = UseChangeGetCount.Checked;
157 Label66.Enabled = UseChangeGetCount.Checked;
158 Label17.Enabled = UseChangeGetCount.Checked;
159 Label25.Enabled = UseChangeGetCount.Checked;
160 SearchTextCountApi.Enabled = UseChangeGetCount.Checked;
161 FavoritesTextCountApi.Enabled = UseChangeGetCount.Checked;
162 UserTimelineTextCountApi.Enabled = UseChangeGetCount.Checked;
163 ListTextCountApi.Enabled = UseChangeGetCount.Checked;
166 private void FirstTextCountApi_Validating(object sender, CancelEventArgs e)
171 cnt = int.Parse(FirstTextCountApi.Text);
175 MessageBox.Show(Properties.Resources.TextCountApi_Validating1);
180 if (cnt != 0 && !Twitter.VerifyFirstApiResultCount(cnt))
182 MessageBox.Show(Properties.Resources.TextCountApi_Validating1);
188 private void SearchTextCountApi_Validating(object sender, CancelEventArgs e)
193 cnt = int.Parse(SearchTextCountApi.Text);
197 MessageBox.Show(Properties.Resources.TextSearchCountApi_Validating1);
202 if (cnt != 0 && !Twitter.VerifyApiResultCount(MyCommon.WORKERTYPE.PublicSearch, cnt))
204 MessageBox.Show(Properties.Resources.TextSearchCountApi_Validating1);
210 private void FavoritesTextCountApi_Validating(object sender, CancelEventArgs e)
215 cnt = int.Parse(FavoritesTextCountApi.Text);
219 MessageBox.Show(Properties.Resources.TextCountApi_Validating1);
224 if (cnt != 0 && !Twitter.VerifyApiResultCount(MyCommon.WORKERTYPE.Favorites, cnt))
226 MessageBox.Show(Properties.Resources.TextCountApi_Validating1);
232 private void UserTimelineTextCountApi_Validating(object sender, CancelEventArgs e)
237 cnt = int.Parse(UserTimelineTextCountApi.Text);
241 MessageBox.Show(Properties.Resources.TextCountApi_Validating1);
246 if (cnt != 0 && !Twitter.VerifyApiResultCount(MyCommon.WORKERTYPE.UserTimeline, cnt))
248 MessageBox.Show(Properties.Resources.TextCountApi_Validating1);
254 private void ListTextCountApi_Validating(object sender, CancelEventArgs e)
259 cnt = int.Parse(ListTextCountApi.Text);
263 MessageBox.Show(Properties.Resources.TextCountApi_Validating1);
268 if (cnt != 0 && !Twitter.VerifyApiResultCount(MyCommon.WORKERTYPE.List, cnt))
270 MessageBox.Show(Properties.Resources.TextCountApi_Validating1);