|
@@ -3,8 +3,9 @@
|
3
|
3
|
using System;
|
4
|
4
|
using System.Configuration;
|
5
|
5
|
using System.Text;
|
|
6
|
+using System.Text.RegularExpressions;
|
6
|
7
|
using System.Windows;
|
7
|
|
-
|
|
8
|
+using System.Windows.Input;
|
8
|
9
|
using XHWK.WKTool.DAL;
|
9
|
10
|
|
10
|
11
|
namespace XHWK.WKTool
|
|
@@ -64,11 +65,21 @@ namespace XHWK.WKTool
|
64
|
65
|
MessageWindow.Show("账号未输入");
|
65
|
66
|
return;
|
66
|
67
|
}
|
|
68
|
+ if(txbAccountNumber.Text.Length>16)
|
|
69
|
+ {
|
|
70
|
+ MessageWindow.Show("账号长度不能高于16位");
|
|
71
|
+ return;
|
|
72
|
+ }
|
67
|
73
|
if (string.IsNullOrEmpty(pobPassword.Password))
|
68
|
74
|
{
|
69
|
75
|
MessageWindow.Show("密码未输入");
|
70
|
76
|
return;
|
71
|
77
|
}
|
|
78
|
+ if (pobPassword.Password.Length > 16)
|
|
79
|
+ {
|
|
80
|
+ MessageWindow.Show("密码长度不能高于16位");
|
|
81
|
+ return;
|
|
82
|
+ }
|
72
|
83
|
APP.myloading.Show();
|
73
|
84
|
Login();
|
74
|
85
|
}
|
|
@@ -188,5 +199,34 @@ namespace XHWK.WKTool
|
188
|
199
|
config.Save(ConfigurationSaveMode.Modified);
|
189
|
200
|
ConfigurationManager.RefreshSection("appSettings");
|
190
|
201
|
}
|
|
202
|
+ /// <summary>
|
|
203
|
+ /// 限制输入特殊字符
|
|
204
|
+ /// </summary>
|
|
205
|
+ /// <param name="sender"></param>
|
|
206
|
+ /// <param name="e"></param>
|
|
207
|
+ private void txbAccountNumber_PreviewTextInput(object sender, TextCompositionEventArgs e)
|
|
208
|
+ {
|
|
209
|
+ try
|
|
210
|
+ {
|
|
211
|
+ Regex re = new Regex("[^0-9\\-]+");
|
|
212
|
+ Regex re1 = new Regex("[^A-Za-z\\-]+");
|
|
213
|
+ if (!re.IsMatch(e.Text))
|
|
214
|
+ {
|
|
215
|
+ e.Handled = re.IsMatch(e.Text);
|
|
216
|
+ }
|
|
217
|
+ else if (!re1.IsMatch(e.Text))
|
|
218
|
+ {
|
|
219
|
+ e.Handled = re1.IsMatch(e.Text);
|
|
220
|
+ }
|
|
221
|
+ else
|
|
222
|
+ {
|
|
223
|
+ e.Handled = true;
|
|
224
|
+ }
|
|
225
|
+
|
|
226
|
+ }
|
|
227
|
+ catch (Exception ex)
|
|
228
|
+ {
|
|
229
|
+ }
|
|
230
|
+ }
|
191
|
231
|
}
|
192
|
232
|
}
|