From d3a44f202c0b12cbac67c71129c3c4f480df55b9 Mon Sep 17 00:00:00 2001
From: xcd <834800634@qq.com>
Date: 星期三, 15 七月 2020 15:48:32 +0800
Subject: [PATCH] 光幕触发修改为同步,消弭信号抖动问题 Excel导出测试

---
 src/Bro.M071.Process/UI/M071_MainForm.cs |   37 +++++++++++++++++++++++++++----------
 1 files changed, 27 insertions(+), 10 deletions(-)

diff --git a/src/Bro.M071.Process/UI/M071_MainForm.cs b/src/Bro.M071.Process/UI/M071_MainForm.cs
index e875fd6..efadaed 100644
--- a/src/Bro.M071.Process/UI/M071_MainForm.cs
+++ b/src/Bro.M071.Process/UI/M071_MainForm.cs
@@ -136,6 +136,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
 
         #region 鏍囩缂栬緫鍖�
@@ -292,7 +313,7 @@
         {
             if (lblMachineState.IsHandleCreated)
             {
-                lblMachineState.BeginInvoke(new Action(() =>
+                lblMachineState.Invoke(new Action(() =>
                 {
                     switch (state)
                     {
@@ -303,7 +324,6 @@
 
                             btnStartMeasure.Text = "寮�濮嬫祴閲�";
                             btnStartMeasure.Enabled = false;
-                            btnStartMeasure.BackColor = Color.Red;
                             break;
                         case MachineState.Pause:
                             btnStartMeasure.BackColor = lblMachineState.BackColor = Color.Yellow;
@@ -312,25 +332,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 +355,6 @@
                             lblMachineState.Text = "鏈煡";
 
                             btnStartMeasure.Enabled = false;
-                            btnStartMeasure.BackColor = Color.Red;
                             break;
                     }
                 }));
@@ -424,11 +440,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 +474,6 @@
             Process_M071.ResetTimer.Change(-1, -1);
         }
         #endregion
+
     }
 }

--
Gitblit v1.8.0