Browse Source

1.4.7 登陆限制账号密码长度、限制账号输入中文特殊符号等。

tags/录制修改前
zhangxueyang 4 years ago
parent
commit
010e6c9755

+ 2
- 2
XHWK.WKTool/App.config View File

@@ -32,8 +32,8 @@
32 32
     <!--上传每片大小 Mb-->
33 33
     <add key="UploadSliceLen" value="1" />
34 34
     <!--版本号-->
35
-    <add key="VersionCode" value="47" />
36
-    <add key="VersionName" value="1.4.6" />
35
+    <add key="VersionCode" value="48" />
36
+    <add key="VersionName" value="1.4.7" />
37 37
     <add key="ClientSettingsProvider.ServiceUri" value="" />
38 38
   </appSettings>
39 39
   <system.web>

+ 1
- 1
XHWK.WKTool/LoginWindow.xaml View File

@@ -93,7 +93,7 @@
93 93
             <TextBlock Text="登陆" FontSize="18" Padding="2,15,10,0"/>
94 94
             <!--输入框-->
95 95
             <Border Background="#cccbce" Width="344" Height="43" CornerRadius="3" Margin="0,0,0,1">
96
-                <TextBox x:Name="txbAccountNumber" Text="" FontSize="16" Foreground="#333333" Padding="5,12,2,2" Width="342" Height="41" BorderBrush="{x:Null}" BorderThickness="0"/>
96
+                <TextBox x:Name="txbAccountNumber" InputMethod.IsInputMethodEnabled="False" PreviewTextInput="txbAccountNumber_PreviewTextInput"  Text="" FontSize="16" Foreground="#333333" Padding="5,12,2,2" Width="342" Height="41" BorderBrush="{x:Null}" BorderThickness="0"/>
97 97
             </Border>
98 98
         </StackPanel>
99 99
         <!--第三行 密码-->

+ 41
- 1
XHWK.WKTool/LoginWindow.xaml.cs View File

@@ -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
 }

+ 2
- 2
XHWK.WKTool/Properties/AssemblyInfo.cs View File

@@ -49,5 +49,5 @@ using System.Windows;
49 49
 //可以指定所有这些值,也可以使用“生成号”和“修订号”的默认值
50 50
 //通过使用 "*",如下所示:
51 51
 // [assembly: AssemblyVersion("1.0.*")]
52
-[assembly: AssemblyVersion("1.4.6.0")]
53
-[assembly: AssemblyFileVersion("1.4.6.0")]
52
+[assembly: AssemblyVersion("1.4.7.0")]
53
+[assembly: AssemblyFileVersion("1.4.7.0")]

Loading…
Cancel
Save