Sfoglia il codice sorgente

验证输入密匙长度

tags/对接微服务前
张剑 2 anni fa
parent
commit
82b71b7343
1 ha cambiato i file con 26 aggiunte e 11 eliminazioni
  1. 26
    11
      XHWK.WKTool/KeyVerification.xaml.cs

+ 26
- 11
XHWK.WKTool/KeyVerification.xaml.cs Vedi File

@@ -16,6 +16,7 @@ namespace XHWK.WKTool
16 16
     /*
17 17
      输入code 调认证服务,成功跳登录 并且调用添加历史接口,失败继续输code
18 18
          */
19
+
19 20
     public partial class KeyVerification : Window
20 21
     {
21 22
         private readonly XHApi registerController = new XHApi();
@@ -30,7 +31,6 @@ namespace XHWK.WKTool
30 31
             Console.WriteLine("初始化KeyVerification");
31 32
         }
32 33
 
33
-
34 34
         private void btnEnd_Click(object sender, RoutedEventArgs e)
35 35
         {
36 36
             if (string.IsNullOrWhiteSpace(txbKey.Text))
@@ -39,14 +39,22 @@ namespace XHWK.WKTool
39 39
                 return;
40 40
             }
41 41
             projectcode = txbKey.Text.Trim();
42
+            if (projectcode.Length > 8)
43
+            {
44
+                MessageWindow.Show("密匙输入过长");
45
+                txbKey.Text = projectcode.Substring(0, 8);
46
+                return;
47
+            }
42 48
             APP.BackgroundWorkerHelper.RunWorkerAsync(InvokeActivationAddServering, InvokeActivationAddServerCompate);
43 49
         }
44 50
 
45 51
         private string projectcode = string.Empty;
52
+
46 53
         /// <summary>
47 54
         /// 认证服务-调用
48 55
         /// </summary>
49
-        /// <returns></returns>
56
+        /// <returns>
57
+        /// </returns>
50 58
         private object InvokeActivationAddServering()
51 59
         {
52 60
             string device = "pcwk";
@@ -58,7 +66,8 @@ namespace XHWK.WKTool
58 66
         /// <summary>
59 67
         /// 认证服务-返回结果
60 68
         /// </summary>
61
-        /// <returns></returns>
69
+        /// <returns>
70
+        /// </returns>
62 71
         public void InvokeActivationAddServerCompate(object obj)
63 72
         {
64 73
             if (serverReturnCode == 0)
@@ -72,7 +81,6 @@ namespace XHWK.WKTool
72 81
                     //win.Topmost = true;
73 82
                     win.Show();
74 83
 
75
-
76 84
                     Thread.Sleep(200);
77 85
                     Close();
78 86
                 }));
@@ -82,10 +90,12 @@ namespace XHWK.WKTool
82 90
                 MessageWindow.Show(APP.ServerMsg);
83 91
             }
84 92
         }
93
+
85 94
         /// <summary>
86 95
         /// 激活信息--添加激活历史-调用
87 96
         /// </summary>
88
-        /// <returns></returns>
97
+        /// <returns>
98
+        /// </returns>
89 99
         private object InvokeActivationAddHistoryServering()
90 100
         {
91 101
             serverReturnCode = registerController.ActivationAddHistory();
@@ -95,7 +105,8 @@ namespace XHWK.WKTool
95 105
         /// <summary>
96 106
         /// 激活信息--添加激活历史-返回结果
97 107
         /// </summary>
98
-        /// <returns></returns>
108
+        /// <returns>
109
+        /// </returns>
99 110
         public void InvokeActivationAddHistoryServerCompate(object obj)
100 111
         {
101 112
             if (!Directory.Exists(APP.DataPath))
@@ -106,10 +117,13 @@ namespace XHWK.WKTool
106 117
             string currentTime = DateTime.Now.ToLongDateString().ToString();//当前时间
107 118
             System.IO.File.WriteAllText(ApplicationData, currentTime, Encoding.Default);//存放签名验证日期
108 119
         }
109
-        /// <summary>  
110
-        /// 获取本机MAC地址  
111
-        /// </summary>  
112
-        /// <returns>本机MAC地址</returns>  
120
+
121
+        /// <summary>
122
+        /// 获取本机MAC地址
123
+        /// </summary>
124
+        /// <returns>
125
+        /// 本机MAC地址
126
+        /// </returns>
113 127
         public static string GetMacAddress()
114 128
         {
115 129
             try
@@ -138,6 +152,7 @@ namespace XHWK.WKTool
138 152
         {
139 153
             closeAction();
140 154
         }
155
+
141 156
         private void closeAction()
142 157
         {
143 158
             APP.myloading.Show();
@@ -150,4 +165,4 @@ namespace XHWK.WKTool
150 165
             }).Start();
151 166
         }
152 167
     }
153
-}
168
+}

Loading…
Annulla
Salva