OSDN Git Service

6bf45f46398c2a51a88e5c1afd8fbd44e49df80b
[opentween/open-tween.git] / OpenTween / Setting / Panel / GetPeriodPanel.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 GetPeriodPanel : SettingPanelBase
39     {
40         public GetPeriodPanel()
41         {
42             InitializeComponent();
43         }
44
45         private void UserstreamPeriod_Validating(object sender, CancelEventArgs e)
46         {
47             int prd;
48             try
49             {
50                 prd = int.Parse(UserstreamPeriod.Text);
51             }
52             catch (Exception)
53             {
54                 MessageBox.Show(Properties.Resources.UserstreamPeriod_ValidatingText1);
55                 e.Cancel = true;
56                 return;
57             }
58
59             if (prd < 0 || prd > 60)
60             {
61                 MessageBox.Show(Properties.Resources.UserstreamPeriod_ValidatingText1);
62                 e.Cancel = true;
63                 return;
64             }
65         }
66
67         private void TimelinePeriod_Validating(object sender, CancelEventArgs e)
68         {
69             int prd;
70             try
71             {
72                 prd = int.Parse(TimelinePeriod.Text);
73             }
74             catch (Exception)
75             {
76                 MessageBox.Show(Properties.Resources.TimelinePeriod_ValidatingText1);
77                 e.Cancel = true;
78                 return;
79             }
80
81             if (prd != 0 && (prd < 15 || prd > 6000))
82             {
83                 MessageBox.Show(Properties.Resources.TimelinePeriod_ValidatingText2);
84                 e.Cancel = true;
85                 return;
86             }
87         }
88
89         private void ReplyPeriod_Validating(object sender, CancelEventArgs e)
90         {
91             int prd;
92             try
93             {
94                 prd = int.Parse(ReplyPeriod.Text);
95             }
96             catch (Exception)
97             {
98                 MessageBox.Show(Properties.Resources.TimelinePeriod_ValidatingText1);
99                 e.Cancel = true;
100                 return;
101             }
102
103             if (prd != 0 && (prd < 15 || prd > 6000))
104             {
105                 MessageBox.Show(Properties.Resources.TimelinePeriod_ValidatingText2);
106                 e.Cancel = true;
107                 return;
108             }
109         }
110
111         private void DMPeriod_Validating(object sender, CancelEventArgs e)
112         {
113             int prd;
114             try
115             {
116                 prd = int.Parse(DMPeriod.Text);
117             }
118             catch (Exception)
119             {
120                 MessageBox.Show(Properties.Resources.DMPeriod_ValidatingText1);
121                 e.Cancel = true;
122                 return;
123             }
124
125             if (prd != 0 && (prd < 15 || prd > 6000))
126             {
127                 MessageBox.Show(Properties.Resources.DMPeriod_ValidatingText2);
128                 e.Cancel = true;
129                 return;
130             }
131         }
132
133         private void PubSearchPeriod_Validating(object sender, CancelEventArgs e)
134         {
135             int prd;
136             try
137             {
138                 prd = int.Parse(PubSearchPeriod.Text);
139             }
140             catch (Exception)
141             {
142                 MessageBox.Show(Properties.Resources.PubSearchPeriod_ValidatingText1);
143                 e.Cancel = true;
144                 return;
145             }
146
147             if (prd != 0 && (prd < 30 || prd > 6000))
148             {
149                 MessageBox.Show(Properties.Resources.PubSearchPeriod_ValidatingText2);
150                 e.Cancel = true;
151             }
152         }
153
154         private void ListsPeriod_Validating(object sender, CancelEventArgs e)
155         {
156             int prd;
157             try
158             {
159                 prd = int.Parse(ListsPeriod.Text);
160             }
161             catch (Exception)
162             {
163                 MessageBox.Show(Properties.Resources.DMPeriod_ValidatingText1);
164                 e.Cancel = true;
165                 return;
166             }
167
168             if (prd != 0 && (prd < 15 || prd > 6000))
169             {
170                 MessageBox.Show(Properties.Resources.DMPeriod_ValidatingText2);
171                 e.Cancel = true;
172                 return;
173             }
174         }
175
176         private void UserTimeline_Validating(object sender, CancelEventArgs e)
177         {
178             int prd;
179             try
180             {
181                 prd = int.Parse(UserTimelinePeriod.Text);
182             }
183             catch (Exception)
184             {
185                 MessageBox.Show(Properties.Resources.DMPeriod_ValidatingText1);
186                 e.Cancel = true;
187                 return;
188             }
189
190             if (prd != 0 && (prd < 15 || prd > 6000))
191             {
192                 MessageBox.Show(Properties.Resources.DMPeriod_ValidatingText2);
193                 e.Cancel = true;
194                 return;
195             }
196         }
197     }
198 }