Browse Source

另类的历史记录功能

张泳健 7 years ago
parent
commit
48cb49094c

+ 87 - 36
GWSocketClient/Form1.Designer.cs View File

31
             this.components = new System.ComponentModel.Container();
31
             this.components = new System.ComponentModel.Container();
32
             System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Form1));
32
             System.ComponentModel.ComponentResourceManager resources = new System.ComponentModel.ComponentResourceManager(typeof(Form1));
33
             this.groupBox1 = new System.Windows.Forms.GroupBox();
33
             this.groupBox1 = new System.Windows.Forms.GroupBox();
34
-            this.cbCCIDIsSource = new System.Windows.Forms.CheckBox();
35
             this.btnTextCmd = new System.Windows.Forms.Button();
34
             this.btnTextCmd = new System.Windows.Forms.Button();
36
             this.buttonCmdManager = new System.Windows.Forms.Button();
35
             this.buttonCmdManager = new System.Windows.Forms.Button();
37
             this.label7 = new System.Windows.Forms.Label();
36
             this.label7 = new System.Windows.Forms.Label();
47
             this.btnLogin = new System.Windows.Forms.Button();
46
             this.btnLogin = new System.Windows.Forms.Button();
48
             this.tbEquipmentAddress = new System.Windows.Forms.TextBox();
47
             this.tbEquipmentAddress = new System.Windows.Forms.TextBox();
49
             this.tbPort = new System.Windows.Forms.TextBox();
48
             this.tbPort = new System.Windows.Forms.TextBox();
50
-            this.label3 = new System.Windows.Forms.Label();
49
+            this.labelCCIDHIS = new System.Windows.Forms.Label();
50
+            this.labelAddHis = new System.Windows.Forms.Label();
51
             this.label2 = new System.Windows.Forms.Label();
51
             this.label2 = new System.Windows.Forms.Label();
52
             this.tbIpaddress = new System.Windows.Forms.TextBox();
52
             this.tbIpaddress = new System.Windows.Forms.TextBox();
53
-            this.label1 = new System.Windows.Forms.Label();
53
+            this.labelIPHIS = new System.Windows.Forms.Label();
54
             this.menuStrip1 = new System.Windows.Forms.MenuStrip();
54
             this.menuStrip1 = new System.Windows.Forms.MenuStrip();
55
             this.文件FToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
55
             this.文件FToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
56
             this.tsmiLoadXml = new System.Windows.Forms.ToolStripMenuItem();
56
             this.tsmiLoadXml = new System.Windows.Forms.ToolStripMenuItem();
57
+            this.toolStripMenuItem1 = new System.Windows.Forms.ToolStripMenuItem();
58
+            this.IPToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
59
+            this.AddrToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
60
+            this.CCIDToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
57
             this.心跳HToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
61
             this.心跳HToolStripMenuItem = new System.Windows.Forms.ToolStripMenuItem();
58
             this.StripMenuItemLoSucHb = new System.Windows.Forms.ToolStripMenuItem();
62
             this.StripMenuItemLoSucHb = new System.Windows.Forms.ToolStripMenuItem();
59
             this.ToolStripMenuItemHbStart = new System.Windows.Forms.ToolStripMenuItem();
63
             this.ToolStripMenuItemHbStart = new System.Windows.Forms.ToolStripMenuItem();
85
             // 
89
             // 
86
             this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
90
             this.groupBox1.Anchor = ((System.Windows.Forms.AnchorStyles)(((System.Windows.Forms.AnchorStyles.Top | System.Windows.Forms.AnchorStyles.Left) 
87
             | System.Windows.Forms.AnchorStyles.Right)));
91
             | System.Windows.Forms.AnchorStyles.Right)));
88
-            this.groupBox1.Controls.Add(this.cbCCIDIsSource);
89
             this.groupBox1.Controls.Add(this.btnTextCmd);
92
             this.groupBox1.Controls.Add(this.btnTextCmd);
90
             this.groupBox1.Controls.Add(this.buttonCmdManager);
93
             this.groupBox1.Controls.Add(this.buttonCmdManager);
91
             this.groupBox1.Controls.Add(this.label7);
94
             this.groupBox1.Controls.Add(this.label7);
101
             this.groupBox1.Controls.Add(this.btnLogin);
104
             this.groupBox1.Controls.Add(this.btnLogin);
102
             this.groupBox1.Controls.Add(this.tbEquipmentAddress);
105
             this.groupBox1.Controls.Add(this.tbEquipmentAddress);
103
             this.groupBox1.Controls.Add(this.tbPort);
106
             this.groupBox1.Controls.Add(this.tbPort);
104
-            this.groupBox1.Controls.Add(this.label3);
107
+            this.groupBox1.Controls.Add(this.labelCCIDHIS);
108
+            this.groupBox1.Controls.Add(this.labelAddHis);
105
             this.groupBox1.Controls.Add(this.label2);
109
             this.groupBox1.Controls.Add(this.label2);
106
             this.groupBox1.Controls.Add(this.tbIpaddress);
110
             this.groupBox1.Controls.Add(this.tbIpaddress);
107
-            this.groupBox1.Controls.Add(this.label1);
111
+            this.groupBox1.Controls.Add(this.labelIPHIS);
108
             this.groupBox1.Location = new System.Drawing.Point(14, 40);
112
             this.groupBox1.Location = new System.Drawing.Point(14, 40);
109
             this.groupBox1.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
113
             this.groupBox1.Margin = new System.Windows.Forms.Padding(3, 4, 3, 4);
110
             this.groupBox1.Name = "groupBox1";
114
             this.groupBox1.Name = "groupBox1";
114
             this.groupBox1.TabStop = false;
118
             this.groupBox1.TabStop = false;
115
             this.groupBox1.Text = "基本信息栏";
119
             this.groupBox1.Text = "基本信息栏";
116
             // 
120
             // 
117
-            // cbCCIDIsSource
118
-            // 
119
-            this.cbCCIDIsSource.AutoSize = true;
120
-            this.cbCCIDIsSource.Location = new System.Drawing.Point(625, 23);
121
-            this.cbCCIDIsSource.Name = "cbCCIDIsSource";
122
-            this.cbCCIDIsSource.Size = new System.Drawing.Size(82, 21);
123
-            this.cbCCIDIsSource.TabIndex = 19;
124
-            this.cbCCIDIsSource.Text = "CCID ? 源";
125
-            this.cbCCIDIsSource.UseVisualStyleBackColor = true;
126
-            // 
127
             // btnTextCmd
121
             // btnTextCmd
128
             // 
122
             // 
129
             this.btnTextCmd.Location = new System.Drawing.Point(596, 61);
123
             this.btnTextCmd.Location = new System.Drawing.Point(596, 61);
269
             this.tbEquipmentAddress.Name = "tbEquipmentAddress";
263
             this.tbEquipmentAddress.Name = "tbEquipmentAddress";
270
             this.tbEquipmentAddress.Size = new System.Drawing.Size(157, 23);
264
             this.tbEquipmentAddress.Size = new System.Drawing.Size(157, 23);
271
             this.tbEquipmentAddress.TabIndex = 5;
265
             this.tbEquipmentAddress.TabIndex = 5;
272
-            this.tbEquipmentAddress.Text = "4442832E833D";
266
+            this.tbEquipmentAddress.Text = "000000000001";
273
             this.tbEquipmentAddress.TextChanged += new System.EventHandler(this.tbEquipmentAddress_TextChanged);
267
             this.tbEquipmentAddress.TextChanged += new System.EventHandler(this.tbEquipmentAddress_TextChanged);
274
             // 
268
             // 
275
             // tbPort
269
             // tbPort
282
             this.tbPort.TabIndex = 3;
276
             this.tbPort.TabIndex = 3;
283
             this.tbPort.Text = "15440";
277
             this.tbPort.Text = "15440";
284
             // 
278
             // 
285
-            // label3
286
-            // 
287
-            this.label3.AutoSize = true;
288
-            this.label3.Location = new System.Drawing.Point(400, 24);
289
-            this.label3.Name = "label3";
290
-            this.label3.Size = new System.Drawing.Size(56, 17);
291
-            this.label3.TabIndex = 4;
292
-            this.label3.Text = "设备地址";
279
+            // labelCCIDHIS
280
+            // 
281
+            this.labelCCIDHIS.AutoSize = true;
282
+            this.labelCCIDHIS.BackColor = System.Drawing.SystemColors.AppWorkspace;
283
+            this.labelCCIDHIS.Cursor = System.Windows.Forms.Cursors.Hand;
284
+            this.labelCCIDHIS.Location = new System.Drawing.Point(625, 24);
285
+            this.labelCCIDHIS.Name = "labelCCIDHIS";
286
+            this.labelCCIDHIS.Size = new System.Drawing.Size(69, 17);
287
+            this.labelCCIDHIS.TabIndex = 4;
288
+            this.labelCCIDHIS.Text = "CCID ? 源?";
289
+            this.labelCCIDHIS.Click += new System.EventHandler(this.labelHis_Click);
290
+            // 
291
+            // labelAddHis
292
+            // 
293
+            this.labelAddHis.AutoSize = true;
294
+            this.labelAddHis.BackColor = System.Drawing.SystemColors.AppWorkspace;
295
+            this.labelAddHis.Cursor = System.Windows.Forms.Cursors.Hand;
296
+            this.labelAddHis.Location = new System.Drawing.Point(400, 24);
297
+            this.labelAddHis.Name = "labelAddHis";
298
+            this.labelAddHis.Size = new System.Drawing.Size(56, 17);
299
+            this.labelAddHis.TabIndex = 4;
300
+            this.labelAddHis.Text = "设备地址";
301
+            this.labelAddHis.Click += new System.EventHandler(this.labelHis_Click);
293
             // 
302
             // 
294
             // label2
303
             // label2
295
             // 
304
             // 
308
             this.tbIpaddress.Name = "tbIpaddress";
317
             this.tbIpaddress.Name = "tbIpaddress";
309
             this.tbIpaddress.Size = new System.Drawing.Size(252, 23);
318
             this.tbIpaddress.Size = new System.Drawing.Size(252, 23);
310
             this.tbIpaddress.TabIndex = 1;
319
             this.tbIpaddress.TabIndex = 1;
311
-            this.tbIpaddress.Text = "120.77.50.131";
320
+            this.tbIpaddress.Text = "127.0.0.1";
312
             // 
321
             // 
313
-            // label1
322
+            // labelIPHIS
314
             // 
323
             // 
315
-            this.label1.AutoSize = true;
316
-            this.label1.Location = new System.Drawing.Point(5, 24);
317
-            this.label1.Name = "label1";
318
-            this.label1.Size = new System.Drawing.Size(19, 17);
319
-            this.label1.TabIndex = 0;
320
-            this.label1.Text = "IP";
324
+            this.labelIPHIS.AutoSize = true;
325
+            this.labelIPHIS.BackColor = System.Drawing.SystemColors.AppWorkspace;
326
+            this.labelIPHIS.Cursor = System.Windows.Forms.Cursors.Hand;
327
+            this.labelIPHIS.Location = new System.Drawing.Point(5, 24);
328
+            this.labelIPHIS.Name = "labelIPHIS";
329
+            this.labelIPHIS.Size = new System.Drawing.Size(19, 17);
330
+            this.labelIPHIS.TabIndex = 0;
331
+            this.labelIPHIS.Text = "IP";
332
+            this.labelIPHIS.Click += new System.EventHandler(this.labelHis_Click);
321
             // 
333
             // 
322
             // menuStrip1
334
             // menuStrip1
323
             // 
335
             // 
324
             this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
336
             this.menuStrip1.Items.AddRange(new System.Windows.Forms.ToolStripItem[] {
325
             this.文件FToolStripMenuItem,
337
             this.文件FToolStripMenuItem,
338
+            this.toolStripMenuItem1,
326
             this.心跳HToolStripMenuItem});
339
             this.心跳HToolStripMenuItem});
327
             this.menuStrip1.Location = new System.Drawing.Point(0, 0);
340
             this.menuStrip1.Location = new System.Drawing.Point(0, 0);
328
             this.menuStrip1.Name = "menuStrip1";
341
             this.menuStrip1.Name = "menuStrip1";
346
             this.tsmiLoadXml.Text = "加载协议XML(&X)";
359
             this.tsmiLoadXml.Text = "加载协议XML(&X)";
347
             this.tsmiLoadXml.Click += new System.EventHandler(this.tsmiLoadXml_Click);
360
             this.tsmiLoadXml.Click += new System.EventHandler(this.tsmiLoadXml_Click);
348
             // 
361
             // 
362
+            // toolStripMenuItem1
363
+            // 
364
+            this.toolStripMenuItem1.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
365
+            this.IPToolStripMenuItem,
366
+            this.AddrToolStripMenuItem,
367
+            this.CCIDToolStripMenuItem});
368
+            this.toolStripMenuItem1.Name = "toolStripMenuItem1";
369
+            this.toolStripMenuItem1.Size = new System.Drawing.Size(44, 21);
370
+            this.toolStripMenuItem1.Text = "记录";
371
+            // 
372
+            // IPToolStripMenuItem
373
+            // 
374
+            this.IPToolStripMenuItem.Name = "IPToolStripMenuItem";
375
+            this.IPToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Alt | System.Windows.Forms.Keys.D1)));
376
+            this.IPToolStripMenuItem.Size = new System.Drawing.Size(187, 22);
377
+            this.IPToolStripMenuItem.Text = "IP记录";
378
+            this.IPToolStripMenuItem.Click += new System.EventHandler(this.IPToolStripMenuItem_Click);
379
+            // 
380
+            // AddrToolStripMenuItem
381
+            // 
382
+            this.AddrToolStripMenuItem.Name = "AddrToolStripMenuItem";
383
+            this.AddrToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Alt | System.Windows.Forms.Keys.D2)));
384
+            this.AddrToolStripMenuItem.Size = new System.Drawing.Size(187, 22);
385
+            this.AddrToolStripMenuItem.Text = "设备地址记录";
386
+            this.AddrToolStripMenuItem.Click += new System.EventHandler(this.AddrToolStripMenuItem_Click);
387
+            // 
388
+            // CCIDToolStripMenuItem
389
+            // 
390
+            this.CCIDToolStripMenuItem.Name = "CCIDToolStripMenuItem";
391
+            this.CCIDToolStripMenuItem.ShortcutKeys = ((System.Windows.Forms.Keys)((System.Windows.Forms.Keys.Alt | System.Windows.Forms.Keys.D3)));
392
+            this.CCIDToolStripMenuItem.Size = new System.Drawing.Size(187, 22);
393
+            this.CCIDToolStripMenuItem.Text = "CCID记录";
394
+            this.CCIDToolStripMenuItem.Click += new System.EventHandler(this.CCIDToolStripMenuItem_Click);
395
+            // 
349
             // 心跳HToolStripMenuItem
396
             // 心跳HToolStripMenuItem
350
             // 
397
             // 
351
             this.心跳HToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
398
             this.心跳HToolStripMenuItem.DropDownItems.AddRange(new System.Windows.Forms.ToolStripItem[] {
548
         private System.Windows.Forms.GroupBox groupBox1;
595
         private System.Windows.Forms.GroupBox groupBox1;
549
         private System.Windows.Forms.TextBox tbEquipmentAddress;
596
         private System.Windows.Forms.TextBox tbEquipmentAddress;
550
         private System.Windows.Forms.TextBox tbPort;
597
         private System.Windows.Forms.TextBox tbPort;
551
-        private System.Windows.Forms.Label label3;
598
+        private System.Windows.Forms.Label labelAddHis;
552
         private System.Windows.Forms.Label label2;
599
         private System.Windows.Forms.Label label2;
553
         private System.Windows.Forms.TextBox tbIpaddress;
600
         private System.Windows.Forms.TextBox tbIpaddress;
554
-        private System.Windows.Forms.Label label1;
601
+        private System.Windows.Forms.Label labelIPHIS;
555
         private System.Windows.Forms.MenuStrip menuStrip1;
602
         private System.Windows.Forms.MenuStrip menuStrip1;
556
         private System.Windows.Forms.ToolStripMenuItem 文件FToolStripMenuItem;
603
         private System.Windows.Forms.ToolStripMenuItem 文件FToolStripMenuItem;
557
         private System.Windows.Forms.StatusStrip statusStrip1;
604
         private System.Windows.Forms.StatusStrip statusStrip1;
586
         private System.Windows.Forms.ToolStripMenuItem ToolStripMenuItemLogHb;
633
         private System.Windows.Forms.ToolStripMenuItem ToolStripMenuItemLogHb;
587
         private System.Windows.Forms.Timer timerHeartBeat;
634
         private System.Windows.Forms.Timer timerHeartBeat;
588
         private System.Windows.Forms.ToolStripMenuItem StripMenuItemLoSucHb;
635
         private System.Windows.Forms.ToolStripMenuItem StripMenuItemLoSucHb;
589
-        private System.Windows.Forms.CheckBox cbCCIDIsSource;
590
         private System.Windows.Forms.ToolStripMenuItem toolStripMenuItemHBtime;
636
         private System.Windows.Forms.ToolStripMenuItem toolStripMenuItemHBtime;
591
         private System.Windows.Forms.ToolStripStatusLabel toolStripStatusLabelHbShow;
637
         private System.Windows.Forms.ToolStripStatusLabel toolStripStatusLabelHbShow;
638
+        private System.Windows.Forms.Label labelCCIDHIS;
639
+        private System.Windows.Forms.ToolStripMenuItem toolStripMenuItem1;
640
+        private System.Windows.Forms.ToolStripMenuItem IPToolStripMenuItem;
641
+        private System.Windows.Forms.ToolStripMenuItem AddrToolStripMenuItem;
642
+        private System.Windows.Forms.ToolStripMenuItem CCIDToolStripMenuItem;
592
     }
643
     }
593
 }
644
 }
594
 
645
 

+ 54 - 11
GWSocketClient/Form1.cs View File

218
             throw new NotImplementedException();
218
             throw new NotImplementedException();
219
         }
219
         }
220
 
220
 
221
+        private void labelHis_Click(object sender, EventArgs e)
222
+        {
223
+            Label lab= sender as Label;
224
+            HistoryDialog hd = new HistoryDialog(lab.Name);
225
+            hd.HistoryHandler += Hd_HistoryHandler;
226
+            hd.ShowDialog();
227
+        }
228
+
229
+        private void Hd_HistoryHandler(string type, string result)
230
+        {
231
+            if ("labelCCIDHIS".Equals(type))
232
+            {
233
+                tbCCID.Text = result;
234
+            }
235
+            else if ("labelAddHis".Equals(type))
236
+            {
237
+                tbEquipmentAddress.Text = result;
238
+            }
239
+            else if ("labelIPHIS".Equals(type))
240
+            {
241
+                tbIpaddress.Text = result;
242
+            }
243
+        }
244
+
245
+        private void IPToolStripMenuItem_Click(object sender, EventArgs e)
246
+        {
247
+            HistoryDialog hd = new HistoryDialog("labelIPHIS");
248
+            hd.HistoryHandler += Hd_HistoryHandler;
249
+            hd.ShowDialog();
250
+        }
251
+
252
+        private void AddrToolStripMenuItem_Click(object sender, EventArgs e)
253
+        {
254
+            HistoryDialog hd = new HistoryDialog("labelAddHis");
255
+            hd.HistoryHandler += Hd_HistoryHandler;
256
+            hd.ShowDialog();
257
+        }
258
+
259
+        private void CCIDToolStripMenuItem_Click(object sender, EventArgs e)
260
+        {
261
+            HistoryDialog hd = new HistoryDialog("labelCCIDHIS");
262
+            hd.HistoryHandler += Hd_HistoryHandler;
263
+            hd.ShowDialog();
264
+        }
265
+
221
         #endregion
266
         #endregion
222
 
267
 
223
 
268
 
457
             string loginCmd = vcarecityProtocolBean.ProtocolStartSymbol;
502
             string loginCmd = vcarecityProtocolBean.ProtocolStartSymbol;
458
             loginCmd += tbEquipmentAddress.Text.Trim() + "82";
503
             loginCmd += tbEquipmentAddress.Text.Trim() + "82";
459
                         
504
                         
460
-
461
-            if(cbCCIDIsSource.Checked)
462
-            {
463
-                loginCmd += Utils.stringWith0(Utils.tenToHex(tbCCID.Text.Trim().Length ), 4);
464
-                loginCmd += Utils.transateCCID(tbCCID.Text.Trim());
465
-            }
466
-            else
467
-            {
468
-                loginCmd += Utils.stringWith0(Utils.tenToHex(tbCCID.Text.Trim().Length / 2), 4);
469
-                loginCmd += tbCCID.Text.Trim();
470
-            }
505
+            
506
+            loginCmd += Utils.stringWith0(Utils.tenToHex(tbCCID.Text.Trim().Length / 2), 4);
507
+            loginCmd += tbCCID.Text.Trim();
508
+            
471
 
509
 
472
             
510
             
473
             loginCmd = Utils.calcCrcCode(loginCmd);
511
             loginCmd = Utils.calcCrcCode(loginCmd);
645
             }
683
             }
646
         }
684
         }
647
 
685
 
686
+
687
+
688
+
689
+
690
+
648
         #endregion
691
         #endregion
649
 
692
 
650
        
693
        

+ 9 - 0
GWSocketClient/GWSocketClient.csproj View File

72
     <Compile Include="Form1.Designer.cs">
72
     <Compile Include="Form1.Designer.cs">
73
       <DependentUpon>Form1.cs</DependentUpon>
73
       <DependentUpon>Form1.cs</DependentUpon>
74
     </Compile>
74
     </Compile>
75
+    <Compile Include="HistoryDialog.cs">
76
+      <SubType>Form</SubType>
77
+    </Compile>
78
+    <Compile Include="HistoryDialog.Designer.cs">
79
+      <DependentUpon>HistoryDialog.cs</DependentUpon>
80
+    </Compile>
75
     <Compile Include="IdItemEditor.cs">
81
     <Compile Include="IdItemEditor.cs">
76
       <SubType>Form</SubType>
82
       <SubType>Form</SubType>
77
     </Compile>
83
     </Compile>
123
     <EmbeddedResource Include="Form1.resx">
129
     <EmbeddedResource Include="Form1.resx">
124
       <DependentUpon>Form1.cs</DependentUpon>
130
       <DependentUpon>Form1.cs</DependentUpon>
125
     </EmbeddedResource>
131
     </EmbeddedResource>
132
+    <EmbeddedResource Include="HistoryDialog.resx">
133
+      <DependentUpon>HistoryDialog.cs</DependentUpon>
134
+    </EmbeddedResource>
126
     <EmbeddedResource Include="IdItemEditor.resx">
135
     <EmbeddedResource Include="IdItemEditor.resx">
127
       <DependentUpon>IdItemEditor.cs</DependentUpon>
136
       <DependentUpon>IdItemEditor.cs</DependentUpon>
128
     </EmbeddedResource>
137
     </EmbeddedResource>

+ 138 - 0
GWSocketClient/HistoryDialog.Designer.cs View File

1
+namespace GWSocketClient
2
+{
3
+    partial class HistoryDialog
4
+    {
5
+        /// <summary>
6
+        /// Required designer variable.
7
+        /// </summary>
8
+        private System.ComponentModel.IContainer components = null;
9
+
10
+        /// <summary>
11
+        /// Clean up any resources being used.
12
+        /// </summary>
13
+        /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param>
14
+        protected override void Dispose(bool disposing)
15
+        {
16
+            if (disposing && (components != null))
17
+            {
18
+                components.Dispose();
19
+            }
20
+            base.Dispose(disposing);
21
+        }
22
+
23
+        #region Windows Form Designer generated code
24
+
25
+        /// <summary>
26
+        /// Required method for Designer support - do not modify
27
+        /// the contents of this method with the code editor.
28
+        /// </summary>
29
+        private void InitializeComponent()
30
+        {
31
+            this.listBoxHistory = new System.Windows.Forms.ListBox();
32
+            this.buttonRandom = new System.Windows.Forms.Button();
33
+            this.buttonCancle = new System.Windows.Forms.Button();
34
+            this.textBoxSourceCCID = new System.Windows.Forms.TextBox();
35
+            this.buttonTransalteCCID = new System.Windows.Forms.Button();
36
+            this.labelCCIDLEN = new System.Windows.Forms.Label();
37
+            this.SuspendLayout();
38
+            // 
39
+            // listBoxHistory
40
+            // 
41
+            this.listBoxHistory.FormattingEnabled = true;
42
+            this.listBoxHistory.ItemHeight = 20;
43
+            this.listBoxHistory.Location = new System.Drawing.Point(12, 7);
44
+            this.listBoxHistory.Name = "listBoxHistory";
45
+            this.listBoxHistory.Size = new System.Drawing.Size(422, 364);
46
+            this.listBoxHistory.TabIndex = 0;
47
+            this.listBoxHistory.DoubleClick += new System.EventHandler(this.listBoxHistory_DoubleClick);
48
+            // 
49
+            // buttonRandom
50
+            // 
51
+            this.buttonRandom.Location = new System.Drawing.Point(190, 433);
52
+            this.buttonRandom.Name = "buttonRandom";
53
+            this.buttonRandom.Size = new System.Drawing.Size(119, 39);
54
+            this.buttonRandom.TabIndex = 1;
55
+            this.buttonRandom.Text = "随机生成";
56
+            this.buttonRandom.UseVisualStyleBackColor = true;
57
+            this.buttonRandom.Visible = false;
58
+            this.buttonRandom.Click += new System.EventHandler(this.buttonRandom_Click);
59
+            // 
60
+            // buttonCancle
61
+            // 
62
+            this.buttonCancle.DialogResult = System.Windows.Forms.DialogResult.Cancel;
63
+            this.buttonCancle.Location = new System.Drawing.Point(315, 433);
64
+            this.buttonCancle.Name = "buttonCancle";
65
+            this.buttonCancle.Size = new System.Drawing.Size(119, 39);
66
+            this.buttonCancle.TabIndex = 2;
67
+            this.buttonCancle.Text = "取消";
68
+            this.buttonCancle.UseVisualStyleBackColor = true;
69
+            // 
70
+            // textBoxSourceCCID
71
+            // 
72
+            this.textBoxSourceCCID.Location = new System.Drawing.Point(12, 401);
73
+            this.textBoxSourceCCID.Name = "textBoxSourceCCID";
74
+            this.textBoxSourceCCID.Size = new System.Drawing.Size(376, 26);
75
+            this.textBoxSourceCCID.TabIndex = 3;
76
+            this.textBoxSourceCCID.Visible = false;
77
+            this.textBoxSourceCCID.TextChanged += new System.EventHandler(this.textBoxSourceCCID_TextChanged);
78
+            // 
79
+            // buttonTransalteCCID
80
+            // 
81
+            this.buttonTransalteCCID.DialogResult = System.Windows.Forms.DialogResult.Cancel;
82
+            this.buttonTransalteCCID.Location = new System.Drawing.Point(65, 433);
83
+            this.buttonTransalteCCID.Name = "buttonTransalteCCID";
84
+            this.buttonTransalteCCID.Size = new System.Drawing.Size(119, 39);
85
+            this.buttonTransalteCCID.TabIndex = 4;
86
+            this.buttonTransalteCCID.Text = "转换";
87
+            this.buttonTransalteCCID.UseVisualStyleBackColor = true;
88
+            this.buttonTransalteCCID.Visible = false;
89
+            this.buttonTransalteCCID.Click += new System.EventHandler(this.buttonTransalteCCID_Click);
90
+            // 
91
+            // labelCCIDLEN
92
+            // 
93
+            this.labelCCIDLEN.AutoSize = true;
94
+            this.labelCCIDLEN.Location = new System.Drawing.Point(394, 404);
95
+            this.labelCCIDLEN.Name = "labelCCIDLEN";
96
+            this.labelCCIDLEN.Size = new System.Drawing.Size(17, 20);
97
+            this.labelCCIDLEN.TabIndex = 5;
98
+            this.labelCCIDLEN.Text = "0";
99
+            this.labelCCIDLEN.Visible = false;
100
+            // 
101
+            // HistoryDialog
102
+            // 
103
+            this.AutoScaleDimensions = new System.Drawing.SizeF(8F, 20F);
104
+            this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font;
105
+            this.CancelButton = this.buttonCancle;
106
+            this.ClientSize = new System.Drawing.Size(446, 484);
107
+            this.Controls.Add(this.labelCCIDLEN);
108
+            this.Controls.Add(this.buttonTransalteCCID);
109
+            this.Controls.Add(this.textBoxSourceCCID);
110
+            this.Controls.Add(this.buttonCancle);
111
+            this.Controls.Add(this.buttonRandom);
112
+            this.Controls.Add(this.listBoxHistory);
113
+            this.Font = new System.Drawing.Font("微软雅黑", 10.5F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, ((byte)(134)));
114
+            this.FormBorderStyle = System.Windows.Forms.FormBorderStyle.FixedSingle;
115
+            this.Margin = new System.Windows.Forms.Padding(4, 5, 4, 5);
116
+            this.MaximizeBox = false;
117
+            this.MinimizeBox = false;
118
+            this.Name = "HistoryDialog";
119
+            this.ShowIcon = false;
120
+            this.ShowInTaskbar = false;
121
+            this.StartPosition = System.Windows.Forms.FormStartPosition.CenterParent;
122
+            this.Text = "历史记录";
123
+            this.Load += new System.EventHandler(this.HistoryDialog_Load);
124
+            this.ResumeLayout(false);
125
+            this.PerformLayout();
126
+
127
+        }
128
+
129
+        #endregion
130
+
131
+        private System.Windows.Forms.ListBox listBoxHistory;
132
+        private System.Windows.Forms.Button buttonRandom;
133
+        private System.Windows.Forms.Button buttonCancle;
134
+        private System.Windows.Forms.TextBox textBoxSourceCCID;
135
+        private System.Windows.Forms.Button buttonTransalteCCID;
136
+        private System.Windows.Forms.Label labelCCIDLEN;
137
+    }
138
+}

+ 134 - 0
GWSocketClient/HistoryDialog.cs View File

1
+using GWSocketClient.util;
2
+using System;
3
+using System.Collections.Generic;
4
+using System.ComponentModel;
5
+using System.Data;
6
+using System.Drawing;
7
+using System.Linq;
8
+using System.Text;
9
+using System.Threading.Tasks;
10
+using System.Windows.Forms;
11
+
12
+namespace GWSocketClient
13
+{
14
+    public delegate void OnHistoryResult(string type,string result);
15
+
16
+    public partial class HistoryDialog : Form
17
+    {
18
+        
19
+        public event OnHistoryResult HistoryHandler;
20
+        private string type;
21
+        
22
+        public HistoryDialog(string type)
23
+        {
24
+            InitializeComponent();
25
+            this.type = type;
26
+        }
27
+
28
+        private void HistoryDialog_Load(object sender, EventArgs e)
29
+        {
30
+
31
+            if ("labelCCIDHIS".Equals(type))
32
+            {
33
+                textBoxSourceCCID.Visible = true;
34
+                labelCCIDLEN.Visible = true;
35
+                buttonTransalteCCID.Visible = true;
36
+                buttonRandom.Visible = true;
37
+                this.Text = "CCID - 历史记录";
38
+            }
39
+            else if ("labelAddHis".Equals(type))
40
+            {
41
+                buttonRandom.Visible = true;
42
+                this.Text = "设备地址 - 历史记录";
43
+            }
44
+            else if ("labelIPHIS".Equals(type))
45
+            {
46
+                this.Text = "IP - 历史记录";
47
+            }
48
+
49
+        }
50
+
51
+        private void buttonRandom_Click(object sender, EventArgs e)
52
+        {
53
+
54
+            if ("labelCCIDHIS".Equals(type))
55
+            {
56
+                HistoryHandler(type, randomCCID());
57
+                this.Close();
58
+            }
59
+            else if ("labelAddHis".Equals(type))
60
+            {
61
+                string add = "00000";
62
+                Random rd = new Random();
63
+                for(int i = 0; i < 7; i++)
64
+                {
65
+                    add += Utils.tenToHex(rd.Next(0, 16));
66
+                }
67
+                HistoryHandler(type, add);
68
+                this.Close();
69
+            }
70
+        }
71
+
72
+        private void textBoxSourceCCID_TextChanged(object sender, EventArgs e)
73
+        {
74
+            string tt = textBoxSourceCCID.Text.Trim();
75
+            if(tt.Length>0)
76
+            {
77
+                labelCCIDLEN.Text = tt.Length+"";
78
+            }
79
+            else
80
+            {
81
+                labelCCIDLEN.Text = "0";
82
+            }
83
+        }
84
+
85
+        private void buttonTransalteCCID_Click(object sender, EventArgs e)
86
+        {
87
+            string result = "";
88
+            string tt = textBoxSourceCCID.Text.Trim();
89
+            if (tt.Length > 0)
90
+            {
91
+                try
92
+                {
93
+                    result = Utils.transateCCID(tt);
94
+                }
95
+                catch(Exception ex)
96
+                {
97
+                    MessageBox.Show(ex.Message);
98
+                    this.DialogResult = DialogResult.None;
99
+                    return; 
100
+                }
101
+            }
102
+            else
103
+            {
104
+                result = randomCCID();
105
+            }
106
+            HistoryHandler(this.type, result);
107
+
108
+        }
109
+
110
+        private string randomCCID()
111
+        {
112
+            string res = "";
113
+            Random rd = new Random();
114
+          
115
+            for (int i=0; i < 20; i++)
116
+            {
117
+                res += rd.Next(30, 40);
118
+            }
119
+
120
+            return res;
121
+        }
122
+
123
+        private void listBoxHistory_DoubleClick(object sender, EventArgs e)
124
+        {
125
+            int index = listBoxHistory.SelectedIndex;
126
+            if (index >= 0 && index < listBoxHistory.Items.Count)
127
+            {
128
+                string info = listBoxHistory.SelectedItem.ToString();
129
+                HistoryHandler(type, info);
130
+                this.Close();
131
+            }
132
+        }
133
+    }
134
+}

+ 120 - 0
GWSocketClient/HistoryDialog.resx View File

1
+<?xml version="1.0" encoding="utf-8"?>
2
+<root>
3
+  <!-- 
4
+    Microsoft ResX Schema 
5
+    
6
+    Version 2.0
7
+    
8
+    The primary goals of this format is to allow a simple XML format 
9
+    that is mostly human readable. The generation and parsing of the 
10
+    various data types are done through the TypeConverter classes 
11
+    associated with the data types.
12
+    
13
+    Example:
14
+    
15
+    ... ado.net/XML headers & schema ...
16
+    <resheader name="resmimetype">text/microsoft-resx</resheader>
17
+    <resheader name="version">2.0</resheader>
18
+    <resheader name="reader">System.Resources.ResXResourceReader, System.Windows.Forms, ...</resheader>
19
+    <resheader name="writer">System.Resources.ResXResourceWriter, System.Windows.Forms, ...</resheader>
20
+    <data name="Name1"><value>this is my long string</value><comment>this is a comment</comment></data>
21
+    <data name="Color1" type="System.Drawing.Color, System.Drawing">Blue</data>
22
+    <data name="Bitmap1" mimetype="application/x-microsoft.net.object.binary.base64">
23
+        <value>[base64 mime encoded serialized .NET Framework object]</value>
24
+    </data>
25
+    <data name="Icon1" type="System.Drawing.Icon, System.Drawing" mimetype="application/x-microsoft.net.object.bytearray.base64">
26
+        <value>[base64 mime encoded string representing a byte array form of the .NET Framework object]</value>
27
+        <comment>This is a comment</comment>
28
+    </data>
29
+                
30
+    There are any number of "resheader" rows that contain simple 
31
+    name/value pairs.
32
+    
33
+    Each data row contains a name, and value. The row also contains a 
34
+    type or mimetype. Type corresponds to a .NET class that support 
35
+    text/value conversion through the TypeConverter architecture. 
36
+    Classes that don't support this are serialized and stored with the 
37
+    mimetype set.
38
+    
39
+    The mimetype is used for serialized objects, and tells the 
40
+    ResXResourceReader how to depersist the object. This is currently not 
41
+    extensible. For a given mimetype the value must be set accordingly:
42
+    
43
+    Note - application/x-microsoft.net.object.binary.base64 is the format 
44
+    that the ResXResourceWriter will generate, however the reader can 
45
+    read any of the formats listed below.
46
+    
47
+    mimetype: application/x-microsoft.net.object.binary.base64
48
+    value   : The object must be serialized with 
49
+            : System.Runtime.Serialization.Formatters.Binary.BinaryFormatter
50
+            : and then encoded with base64 encoding.
51
+    
52
+    mimetype: application/x-microsoft.net.object.soap.base64
53
+    value   : The object must be serialized with 
54
+            : System.Runtime.Serialization.Formatters.Soap.SoapFormatter
55
+            : and then encoded with base64 encoding.
56
+
57
+    mimetype: application/x-microsoft.net.object.bytearray.base64
58
+    value   : The object must be serialized into a byte array 
59
+            : using a System.ComponentModel.TypeConverter
60
+            : and then encoded with base64 encoding.
61
+    -->
62
+  <xsd:schema id="root" xmlns="" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:msdata="urn:schemas-microsoft-com:xml-msdata">
63
+    <xsd:import namespace="http://www.w3.org/XML/1998/namespace" />
64
+    <xsd:element name="root" msdata:IsDataSet="true">
65
+      <xsd:complexType>
66
+        <xsd:choice maxOccurs="unbounded">
67
+          <xsd:element name="metadata">
68
+            <xsd:complexType>
69
+              <xsd:sequence>
70
+                <xsd:element name="value" type="xsd:string" minOccurs="0" />
71
+              </xsd:sequence>
72
+              <xsd:attribute name="name" use="required" type="xsd:string" />
73
+              <xsd:attribute name="type" type="xsd:string" />
74
+              <xsd:attribute name="mimetype" type="xsd:string" />
75
+              <xsd:attribute ref="xml:space" />
76
+            </xsd:complexType>
77
+          </xsd:element>
78
+          <xsd:element name="assembly">
79
+            <xsd:complexType>
80
+              <xsd:attribute name="alias" type="xsd:string" />
81
+              <xsd:attribute name="name" type="xsd:string" />
82
+            </xsd:complexType>
83
+          </xsd:element>
84
+          <xsd:element name="data">
85
+            <xsd:complexType>
86
+              <xsd:sequence>
87
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
88
+                <xsd:element name="comment" type="xsd:string" minOccurs="0" msdata:Ordinal="2" />
89
+              </xsd:sequence>
90
+              <xsd:attribute name="name" type="xsd:string" use="required" msdata:Ordinal="1" />
91
+              <xsd:attribute name="type" type="xsd:string" msdata:Ordinal="3" />
92
+              <xsd:attribute name="mimetype" type="xsd:string" msdata:Ordinal="4" />
93
+              <xsd:attribute ref="xml:space" />
94
+            </xsd:complexType>
95
+          </xsd:element>
96
+          <xsd:element name="resheader">
97
+            <xsd:complexType>
98
+              <xsd:sequence>
99
+                <xsd:element name="value" type="xsd:string" minOccurs="0" msdata:Ordinal="1" />
100
+              </xsd:sequence>
101
+              <xsd:attribute name="name" type="xsd:string" use="required" />
102
+            </xsd:complexType>
103
+          </xsd:element>
104
+        </xsd:choice>
105
+      </xsd:complexType>
106
+    </xsd:element>
107
+  </xsd:schema>
108
+  <resheader name="resmimetype">
109
+    <value>text/microsoft-resx</value>
110
+  </resheader>
111
+  <resheader name="version">
112
+    <value>2.0</value>
113
+  </resheader>
114
+  <resheader name="reader">
115
+    <value>System.Resources.ResXResourceReader, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
116
+  </resheader>
117
+  <resheader name="writer">
118
+    <value>System.Resources.ResXResourceWriter, System.Windows.Forms, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089</value>
119
+  </resheader>
120
+</root>

+ 2 - 2
GWSocketClient/util/Utils.cs View File

133
         public static string transateCCID(string source)
133
         public static string transateCCID(string source)
134
         {
134
         {
135
             string res = "";
135
             string res = "";
136
-            for(int i=0;i< source.Length; i++)
136
+            for(int i=0;i <  source.Length; i++)
137
             {
137
             {
138
                 int hex = Int32.Parse(source[i].ToString(), NumberStyles.HexNumber);
138
                 int hex = Int32.Parse(source[i].ToString(), NumberStyles.HexNumber);
139
-                int ten = hexToTen(hex + "")+30;
139
+                int ten = hexToTen(hex + "") + 30;
140
 
140
 
141
                 res += ten + "";
141
                 res += ten + "";
142
                // Console.WriteLine(ten);
142
                // Console.WriteLine(ten);