领胜LDS 键盘AOI检测项目
wells.liu
2020-07-03 b83a01eec16b236d099dcea3e7a5051c8cae9c6c
src/Bro.UI.Config/MenuForms/FrmOperation.cs
@@ -1,5 +1,6 @@
using Bro.Common.Factory;
using Bro.Common.Helper;
using Bro.Common.PubSub;
using Bro.UI.Model.Winform;
using System;
using System.Collections.Generic;
@@ -9,6 +10,7 @@
using System.Threading.Tasks;
using System.Windows.Forms;
using WeifenLuo.WinFormsUI.Docking;
using static Bro.Common.Helper.EnumHelper;
namespace Bro.UI.Config.MenuForms
{
@@ -20,6 +22,8 @@
        public FrmOperation()
        {
            InitializeComponent();
            PubSubCenter.GetInstance().RemoveSubscribers(PubSubCenterMessageType.UpdateProductionCodes.ToString());
            PubSubCenter.GetInstance().Subscribe(PubSubCenterMessageType.UpdateProductionCodes.ToString(), OnUpdateProductionCodes);
            LoadProcessCode();
            LoadProductionCode();
@@ -39,6 +43,12 @@
        #region Load Codes
        string _processCode = "";
        string _productionCode = "";
        private object OnUpdateProductionCodes(ISubscriber arg1, object arg2, object arg3)
        {
            LoadProductionCode();
            return null;
        }
        private void LoadProcessCode()
        {
@@ -140,10 +150,12 @@
            btnStart.Enabled = false;
            //Task.Run(() =>
            //{
            try
            {
                //if (Process.ProcessState != EnumHelper.DeviceState.DSOpen)
                if(isStart)
                if (isStart)
                {
                    ProcessOperation(true);
                }
@@ -160,8 +172,9 @@
            }
            finally
            {
                btnStart.Enabled = true;
                this.BeginInvoke(new Action(() => btnStart.Enabled = true));
            }
            //});
        }
        string _currentProcssCode = "";
@@ -248,21 +261,28 @@
            {
                Process.Open();
                //this.BeginInvoke(new Action(() =>
                //{
                btnStart.Text = "  停  止";
                btnStart.ImageIndex = 1;
                btnStart.BackColor = Color.FromArgb(0x7f, Color.LimeGreen);
                btnLoad.Enabled = false;
                //}));
            }
            else
            {
                Process.Close();
                //this.BeginInvoke(new Action(() =>
                //{
                btnStart.Text = "  启  动";
                btnStart.ImageIndex = 0;
                btnStart.BackColor = SystemColors.Control;
                btnLoad.Enabled = true;
                //}));
            }
        }
    }