领胜LDS 键盘AOI检测项目
xcd
2020-07-15 d3a44f202c0b12cbac67c71129c3c4f480df55b9
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
    }
}