From c44c1b442fde596c1d20c0ad82e4d308f71ec806 Mon Sep 17 00:00:00 2001
From: xcd <834800634@qq.com>
Date: 星期六, 01 八月 2020 13:55:46 +0800
Subject: [PATCH] 部分修改

---
 src/Bro.M071.Process/UI/M071_MainForm.cs |   49 ++++++++++++++++++++++++++++++++++++++-----------
 1 files changed, 38 insertions(+), 11 deletions(-)

diff --git a/src/Bro.M071.Process/UI/M071_MainForm.cs b/src/Bro.M071.Process/UI/M071_MainForm.cs
index e875fd6..0ed4652 100644
--- a/src/Bro.M071.Process/UI/M071_MainForm.cs
+++ b/src/Bro.M071.Process/UI/M071_MainForm.cs
@@ -40,6 +40,8 @@
                    cvImage.SetScreenSize();
                    cvImage.OnElementChangedHandle -= CvImage_OnElementChangedHandle;
                    cvImage.OnElementChangedHandle += CvImage_OnElementChangedHandle;
+
+                   timer1.Enabled = true;
                };
         }
 
@@ -135,6 +137,27 @@
         {
             tscEditLocation.Visible = tsmiShowEditor.Checked;
             tscEditLocation.BringToFront();
+        }
+
+        private void tsmiRefreshLabels_Click(object sender, EventArgs e)
+        {
+            cvImage.Elements.Clear();
+            lvMeasures.Items.Clear();
+
+            Config.MeasurementUnitCollection.ForEach(u =>
+            {
+                if (!u.IsEnabled)
+                    return;
+
+                var ele = new KeyIndicator(u.Id, u.DisplayLocation);
+                cvImage.Elements.Add(ele);
+
+                ListViewItem item = new ListViewItem(u.GetDisplayText());
+                item.Tag = u.Id;
+                lvMeasures.Items.Add(item);
+            });
+
+            this.Invalidate();
         }
         #endregion
 
@@ -263,6 +286,10 @@
             {
                 _barcode += keyStr.ToUpper();
             }
+            else if (keyStr.Length == 2 && keyStr.StartsWith("D"))
+            {
+                _barcode += keyStr.Substring(1).ToUpper();
+            }
 
             if (e.KeyValue == 13)
             {
@@ -292,7 +319,7 @@
         {
             if (lblMachineState.IsHandleCreated)
             {
-                lblMachineState.BeginInvoke(new Action(() =>
+                lblMachineState.Invoke(new Action(() =>
                 {
                     switch (state)
                     {
@@ -303,7 +330,6 @@
 
                             btnStartMeasure.Text = "寮�濮嬫祴閲�";
                             btnStartMeasure.Enabled = false;
-                            btnStartMeasure.BackColor = Color.Red;
                             break;
                         case MachineState.Pause:
                             btnStartMeasure.BackColor = lblMachineState.BackColor = Color.Yellow;
@@ -312,25 +338,22 @@
 
                             btnStartMeasure.Text = "缁х画娴嬮噺";
                             btnStartMeasure.Enabled = true;
-                            btnStartMeasure.BackColor = Color.Lime;
                             break;
                         case MachineState.Ready:
                             btnStartMeasure.BackColor = lblMachineState.BackColor = Color.Lime;
-                            btnStartMeasure.ForeColor = lblMachineState.ForeColor = Color.White;
+                            btnStartMeasure.ForeColor = lblMachineState.ForeColor = Color.Black;
                             lblMachineState.Text = "灏辩华";
-                            
+
                             btnStartMeasure.Text = "寮�濮嬫祴閲�";
                             btnStartMeasure.Enabled = true;
-                            btnStartMeasure.BackColor = Color.Lime;
                             break;
                         case MachineState.Running:
-                            btnStartMeasure.BackColor = lblMachineState.BackColor = Color.Lime;
+                            btnStartMeasure.BackColor = lblMachineState.BackColor = Color.Transparent;
                             btnStartMeasure.ForeColor = lblMachineState.ForeColor = Color.DarkGreen;
                             lblMachineState.Text = "杩愯";
 
                             btnStartMeasure.Text = "鏆傚仠娴嬮噺";
                             btnStartMeasure.Enabled = true;
-                            btnStartMeasure.BackColor = Color.Lime;
                             break;
                         case MachineState.Unknown:
                             btnStartMeasure.BackColor = lblMachineState.BackColor = SystemColors.Control;
@@ -338,7 +361,6 @@
                             lblMachineState.Text = "鏈煡";
 
                             btnStartMeasure.Enabled = false;
-                            btnStartMeasure.BackColor = Color.Red;
                             break;
                     }
                 }));
@@ -424,11 +446,11 @@
             }
             else if (btnStartMeasure.Text == "缁х画娴嬮噺")
             {
-                Process_M071.SwitchJobStatus(new OperationConfigBase() { InputPara = new List<int>() { 0 } }, null, null);
+                Process_M071.SwitchJobStatus(new OperationConfigBase() { InputPara = new List<int>() { 10 } }, null, null);
             }
             else
             {
-                Process_M071.SwitchJobStatus(new OperationConfigBase() { InputPara = new List<int>() { 1 } }, null, null);
+                Process_M071.SwitchJobStatus(new OperationConfigBase() { InputPara = new List<int>() { 11 } }, null, null);
             }
         }
 
@@ -458,5 +480,10 @@
             Process_M071.ResetTimer.Change(-1, -1);
         }
         #endregion
+
+        private void timer1_Tick(object sender, EventArgs e)
+        {
+            cvImage.Refresh();
+        }
     }
 }

--
Gitblit v1.8.0