领胜LDS 键盘AOI检测项目
wells.liu
2020-07-04 642cd31f0d1586a2a5ca6f9a3b3364725f4f1ecd
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()
        {
@@ -130,7 +140,7 @@
        }
        bool isStart = true;
        private void btnStart_Click(object sender, System.EventArgs e)
        private async void btnStart_Click(object sender, System.EventArgs e)
        {
            if (Process == null)
            {
@@ -147,11 +157,11 @@
                //if (Process.ProcessState != EnumHelper.DeviceState.DSOpen)
                if (isStart)
                {
                    ProcessOperation(true);
                    await ProcessOperation(true);
                }
                else
                {
                    ProcessOperation(false);
                    await ProcessOperation(false);
                }
                isStart = !isStart;
@@ -162,7 +172,8 @@
            }
            finally
            {
                this.BeginInvoke(new Action(() => btnStart.Enabled = true));
                //this.BeginInvoke(new Action(() => btnStart.Enabled = true));
                btnStart.Enabled = true;
            }
            //});
        }
@@ -245,11 +256,11 @@
        //    }
        //}
        private void ProcessOperation(bool isStart)
        private async Task ProcessOperation(bool isStart)
        {
            if (isStart)
            {
                Process.Open();
                await Task.Run(() => Process.Open());
                //this.BeginInvoke(new Action(() =>
                //{
@@ -263,7 +274,7 @@
            }
            else
            {
                Process.Close();
                await Task.Run(() => Process.Close());
                //this.BeginInvoke(new Action(() =>
                //{