OSDN Git Service

Merge branch 'settingdialog'
[opentween/open-tween.git] / OpenTween / Setting / Panel / GetPeriodPanel.cs
1 using System;
2 using System.Collections.Generic;
3 using System.ComponentModel;
4 using System.Drawing;
5 using System.Data;
6 using System.Linq;
7 using System.Text;
8 using System.Windows.Forms;
9
10 namespace OpenTween.Setting.Panel
11 {
12     public partial class GetPeriodPanel : SettingPanelBase
13     {
14         public GetPeriodPanel()
15         {
16             InitializeComponent();
17         }
18
19         private void UserstreamPeriod_Validating(object sender, CancelEventArgs e)
20         {
21             int prd;
22             try
23             {
24                 prd = int.Parse(UserstreamPeriod.Text);
25             }
26             catch (Exception)
27             {
28                 MessageBox.Show(Properties.Resources.UserstreamPeriod_ValidatingText1);
29                 e.Cancel = true;
30                 return;
31             }
32
33             if (prd < 0 || prd > 60)
34             {
35                 MessageBox.Show(Properties.Resources.UserstreamPeriod_ValidatingText1);
36                 e.Cancel = true;
37                 return;
38             }
39         }
40
41         private void TimelinePeriod_Validating(object sender, CancelEventArgs e)
42         {
43             int prd;
44             try
45             {
46                 prd = int.Parse(TimelinePeriod.Text);
47             }
48             catch (Exception)
49             {
50                 MessageBox.Show(Properties.Resources.TimelinePeriod_ValidatingText1);
51                 e.Cancel = true;
52                 return;
53             }
54
55             if (prd != 0 && (prd < 15 || prd > 6000))
56             {
57                 MessageBox.Show(Properties.Resources.TimelinePeriod_ValidatingText2);
58                 e.Cancel = true;
59                 return;
60             }
61         }
62
63         private void ReplyPeriod_Validating(object sender, CancelEventArgs e)
64         {
65             int prd;
66             try
67             {
68                 prd = int.Parse(ReplyPeriod.Text);
69             }
70             catch (Exception)
71             {
72                 MessageBox.Show(Properties.Resources.TimelinePeriod_ValidatingText1);
73                 e.Cancel = true;
74                 return;
75             }
76
77             if (prd != 0 && (prd < 15 || prd > 6000))
78             {
79                 MessageBox.Show(Properties.Resources.TimelinePeriod_ValidatingText2);
80                 e.Cancel = true;
81                 return;
82             }
83         }
84
85         private void DMPeriod_Validating(object sender, CancelEventArgs e)
86         {
87             int prd;
88             try
89             {
90                 prd = int.Parse(DMPeriod.Text);
91             }
92             catch (Exception)
93             {
94                 MessageBox.Show(Properties.Resources.DMPeriod_ValidatingText1);
95                 e.Cancel = true;
96                 return;
97             }
98
99             if (prd != 0 && (prd < 15 || prd > 6000))
100             {
101                 MessageBox.Show(Properties.Resources.DMPeriod_ValidatingText2);
102                 e.Cancel = true;
103                 return;
104             }
105         }
106
107         private void PubSearchPeriod_Validating(object sender, CancelEventArgs e)
108         {
109             int prd;
110             try
111             {
112                 prd = int.Parse(PubSearchPeriod.Text);
113             }
114             catch (Exception)
115             {
116                 MessageBox.Show(Properties.Resources.PubSearchPeriod_ValidatingText1);
117                 e.Cancel = true;
118                 return;
119             }
120
121             if (prd != 0 && (prd < 30 || prd > 6000))
122             {
123                 MessageBox.Show(Properties.Resources.PubSearchPeriod_ValidatingText2);
124                 e.Cancel = true;
125             }
126         }
127
128         private void ListsPeriod_Validating(object sender, CancelEventArgs e)
129         {
130             int prd;
131             try
132             {
133                 prd = int.Parse(ListsPeriod.Text);
134             }
135             catch (Exception)
136             {
137                 MessageBox.Show(Properties.Resources.DMPeriod_ValidatingText1);
138                 e.Cancel = true;
139                 return;
140             }
141
142             if (prd != 0 && (prd < 15 || prd > 6000))
143             {
144                 MessageBox.Show(Properties.Resources.DMPeriod_ValidatingText2);
145                 e.Cancel = true;
146                 return;
147             }
148         }
149
150         private void UserTimeline_Validating(object sender, CancelEventArgs e)
151         {
152             int prd;
153             try
154             {
155                 prd = int.Parse(UserTimelinePeriod.Text);
156             }
157             catch (Exception)
158             {
159                 MessageBox.Show(Properties.Resources.DMPeriod_ValidatingText1);
160                 e.Cancel = true;
161                 return;
162             }
163
164             if (prd != 0 && (prd < 15 || prd > 6000))
165             {
166                 MessageBox.Show(Properties.Resources.DMPeriod_ValidatingText2);
167                 e.Cancel = true;
168                 return;
169             }
170         }
171     }
172 }