From 57fd8b118173baace3943edcba87cb48e3dc48dc Mon Sep 17 00:00:00 2001 From: xxe Date: Tue, 15 Nov 2022 13:20:35 +0800 Subject: [PATCH] =?UTF-8?q?=E4=B8=80=E5=8D=A1=E9=80=9A=E8=B0=83=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- HKCardManager/Form1.Designer.cs | 60 +++++++++++++++++++++++++-------- HKCardManager/Form1.cs | 36 +++++++++++++++++++- HKCardManager/Form1.resx | 6 ++++ 3 files changed, 87 insertions(+), 15 deletions(-) diff --git a/HKCardManager/Form1.Designer.cs b/HKCardManager/Form1.Designer.cs index a5de7a1..b5984ea 100644 --- a/HKCardManager/Form1.Designer.cs +++ b/HKCardManager/Form1.Designer.cs @@ -28,8 +28,8 @@ /// private void InitializeComponent() { - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle1 = new System.Windows.Forms.DataGridViewCellStyle(); - System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle2 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle3 = new System.Windows.Forms.DataGridViewCellStyle(); + System.Windows.Forms.DataGridViewCellStyle dataGridViewCellStyle4 = new System.Windows.Forms.DataGridViewCellStyle(); this.splitContainer1 = new System.Windows.Forms.SplitContainer(); this.groupBox5 = new System.Windows.Forms.GroupBox(); this.pictureBox11 = new System.Windows.Forms.PictureBox(); @@ -66,6 +66,8 @@ this.dataGridView1 = new System.Windows.Forms.DataGridView(); this.图标 = new System.Windows.Forms.DataGridViewTextBoxColumn(); this.消息文本 = new System.Windows.Forms.DataGridViewTextBoxColumn(); + this.button14 = new System.Windows.Forms.Button(); + this.pictureBox13 = new System.Windows.Forms.PictureBox(); ((System.ComponentModel.ISupportInitialize)(this.splitContainer1)).BeginInit(); this.splitContainer1.Panel1.SuspendLayout(); this.splitContainer1.Panel2.SuspendLayout(); @@ -92,6 +94,7 @@ this.splitContainer2.Panel2.SuspendLayout(); this.splitContainer2.SuspendLayout(); ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).BeginInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox13)).BeginInit(); this.SuspendLayout(); // // splitContainer1 @@ -113,7 +116,7 @@ // this.splitContainer1.Panel2.BackColor = System.Drawing.SystemColors.Highlight; this.splitContainer1.Panel2.Controls.Add(this.splitContainer2); - this.splitContainer1.Size = new System.Drawing.Size(1207, 717); + this.splitContainer1.Size = new System.Drawing.Size(1207, 718); this.splitContainer1.SplitterDistance = 249; this.splitContainer1.TabIndex = 1; // @@ -124,7 +127,7 @@ this.groupBox5.Controls.Add(this.button8); this.groupBox5.Font = new System.Drawing.Font("Microsoft YaHei UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); this.groupBox5.ForeColor = System.Drawing.Color.Black; - this.groupBox5.Location = new System.Drawing.Point(3, 615); + this.groupBox5.Location = new System.Drawing.Point(4, 645); this.groupBox5.Name = "groupBox5"; this.groupBox5.Size = new System.Drawing.Size(243, 77); this.groupBox5.TabIndex = 12; @@ -228,7 +231,7 @@ this.groupBox4.Controls.Add(this.button12); this.groupBox4.Font = new System.Drawing.Font("Microsoft YaHei UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); this.groupBox4.ForeColor = System.Drawing.Color.Black; - this.groupBox4.Location = new System.Drawing.Point(3, 534); + this.groupBox4.Location = new System.Drawing.Point(3, 566); this.groupBox4.Name = "groupBox4"; this.groupBox4.Size = new System.Drawing.Size(243, 77); this.groupBox4.TabIndex = 3; @@ -270,7 +273,7 @@ this.groupBox3.Controls.Add(this.button11); this.groupBox3.Font = new System.Drawing.Font("Microsoft YaHei UI", 12F, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point); this.groupBox3.ForeColor = System.Drawing.Color.Black; - this.groupBox3.Location = new System.Drawing.Point(3, 368); + this.groupBox3.Location = new System.Drawing.Point(3, 408); this.groupBox3.Name = "groupBox3"; this.groupBox3.Size = new System.Drawing.Size(243, 159); this.groupBox3.TabIndex = 5; @@ -355,6 +358,8 @@ // groupBox2 // this.groupBox2.BackColor = System.Drawing.SystemColors.Control; + this.groupBox2.Controls.Add(this.pictureBox13); + this.groupBox2.Controls.Add(this.button14); this.groupBox2.Controls.Add(this.pictureBox12); this.groupBox2.Controls.Add(this.button13); this.groupBox2.Controls.Add(this.pictureBox6); @@ -369,7 +374,7 @@ this.groupBox2.ForeColor = System.Drawing.Color.Black; this.groupBox2.Location = new System.Drawing.Point(3, 118); this.groupBox2.Name = "groupBox2"; - this.groupBox2.Size = new System.Drawing.Size(243, 246); + this.groupBox2.Size = new System.Drawing.Size(243, 287); this.groupBox2.TabIndex = 3; this.groupBox2.TabStop = false; this.groupBox2.Text = "卡片维护"; @@ -527,7 +532,7 @@ // splitContainer2.Panel2 // this.splitContainer2.Panel2.Controls.Add(this.dataGridView1); - this.splitContainer2.Size = new System.Drawing.Size(954, 717); + this.splitContainer2.Size = new System.Drawing.Size(954, 718); this.splitContainer2.SplitterDistance = 539; this.splitContainer2.TabIndex = 0; // @@ -557,13 +562,13 @@ this.dataGridView1.RowHeadersBorderStyle = System.Windows.Forms.DataGridViewHeaderBorderStyle.None; this.dataGridView1.RowHeadersVisible = false; this.dataGridView1.RowTemplate.Height = 25; - this.dataGridView1.Size = new System.Drawing.Size(954, 174); + this.dataGridView1.Size = new System.Drawing.Size(954, 175); this.dataGridView1.TabIndex = 1; // // 图标 // - dataGridViewCellStyle1.Alignment = System.Windows.Forms.DataGridViewContentAlignment.TopCenter; - this.图标.DefaultCellStyle = dataGridViewCellStyle1; + dataGridViewCellStyle3.Alignment = System.Windows.Forms.DataGridViewContentAlignment.TopCenter; + this.图标.DefaultCellStyle = dataGridViewCellStyle3; this.图标.HeaderText = "图标"; this.图标.Name = "图标"; this.图标.ReadOnly = true; @@ -572,17 +577,41 @@ // 消息文本 // this.消息文本.AutoSizeMode = System.Windows.Forms.DataGridViewAutoSizeColumnMode.Fill; - dataGridViewCellStyle2.WrapMode = System.Windows.Forms.DataGridViewTriState.True; - this.消息文本.DefaultCellStyle = dataGridViewCellStyle2; + dataGridViewCellStyle4.WrapMode = System.Windows.Forms.DataGridViewTriState.True; + this.消息文本.DefaultCellStyle = dataGridViewCellStyle4; this.消息文本.HeaderText = "消息文本"; this.消息文本.Name = "消息文本"; this.消息文本.ReadOnly = true; // + // button14 + // + this.button14.BackColor = System.Drawing.SystemColors.Control; + this.button14.Location = new System.Drawing.Point(9, 244); + this.button14.Name = "button14"; + this.button14.Padding = new System.Windows.Forms.Padding(30, 0, 0, 0); + this.button14.Size = new System.Drawing.Size(220, 36); + this.button14.TabIndex = 10; + this.button14.Text = "重置"; + this.button14.TextAlign = System.Drawing.ContentAlignment.MiddleLeft; + this.button14.UseVisualStyleBackColor = false; + this.button14.Click += new System.EventHandler(this.button14_Click); + // + // pictureBox13 + // + this.pictureBox13.BackColor = System.Drawing.Color.Transparent; + this.pictureBox13.Image = global::HKCardManager.Properties.Resources.shijianshezhi; + this.pictureBox13.Location = new System.Drawing.Point(20, 251); + this.pictureBox13.Name = "pictureBox13"; + this.pictureBox13.Size = new System.Drawing.Size(20, 20); + this.pictureBox13.SizeMode = System.Windows.Forms.PictureBoxSizeMode.Zoom; + this.pictureBox13.TabIndex = 12; + this.pictureBox13.TabStop = false; + // // Form1 // this.AutoScaleDimensions = new System.Drawing.SizeF(7F, 17F); this.AutoScaleMode = System.Windows.Forms.AutoScaleMode.Font; - this.ClientSize = new System.Drawing.Size(1207, 717); + this.ClientSize = new System.Drawing.Size(1207, 718); this.Controls.Add(this.splitContainer1); this.Name = "Form1"; this.StartPosition = System.Windows.Forms.FormStartPosition.CenterScreen; @@ -613,6 +642,7 @@ ((System.ComponentModel.ISupportInitialize)(this.splitContainer2)).EndInit(); this.splitContainer2.ResumeLayout(false); ((System.ComponentModel.ISupportInitialize)(this.dataGridView1)).EndInit(); + ((System.ComponentModel.ISupportInitialize)(this.pictureBox13)).EndInit(); this.ResumeLayout(false); } @@ -654,5 +684,7 @@ private DataGridViewTextBoxColumn 消息文本; private Button button13; private PictureBox pictureBox12; + private PictureBox pictureBox13; + private Button button14; } } \ No newline at end of file diff --git a/HKCardManager/Form1.cs b/HKCardManager/Form1.cs index f17a898..a5c67e6 100644 --- a/HKCardManager/Form1.cs +++ b/HKCardManager/Form1.cs @@ -5,6 +5,7 @@ using HKLib.SQLHelper; using System.Text.RegularExpressions; using HKHelper; using UHFHelper; +using Snowflake.Core; namespace HKCardManager { @@ -313,7 +314,7 @@ namespace HKCardManager return; } - if (res.Equals("666") || res.Equals("888") || res.Equals("999")) + if (res.Equals("666") || res.Equals("888") || res.Equals("999")) { MessageBox.Show("ܱע"); return; @@ -357,6 +358,39 @@ namespace HKCardManager MessageLogNotify.GetInstance.ShowWarning("豸δ"); } } + + private void button14_Click(object sender, EventArgs e) + { + + if (UHFCardHelper.GetInstance().ComOpen) + { + try + { + var res = UHFCardHelper.GetInstance().ReadCard(); + + if (string.IsNullOrEmpty(res)) + { + MessageBox.Show("ʾ\n 뿨Ƭѡ..."); + MessageLogNotify.GetInstance.Show("뿨Ƭ"); + return; + } + UHFCardHelper.GetInstance().WriteCard("000"); + string worker = new IdWorker(1, 1).NextId().ToString();// ID + var resm = UHFCardHelper.GetInstance().WriteCard(worker); + MessageLogNotify.GetInstance.ShowWarning("Ƭóɹ"+resm.Res); + MessageBox.Show("ʾ\n Ƭóɹ"+resm.Res); + } + catch (Exception) + { + MessageBox.Show("ÿƬʧ"); + } + } + else + { + MessageBox.Show("ʾ\n 豸δ..."); + MessageLogNotify.GetInstance.ShowWarning("豸δ"); + } + } } diff --git a/HKCardManager/Form1.resx b/HKCardManager/Form1.resx index 1338f61..9876a5b 100644 --- a/HKCardManager/Form1.resx +++ b/HKCardManager/Form1.resx @@ -63,4 +63,10 @@ True + + True + + + True + \ No newline at end of file