From 753b5add58defa5c09015308efb81bcaea0ebe91 Mon Sep 17 00:00:00 2001
From: xcd <834800634@qq.com>
Date: 星期六, 04 七月 2020 12:36:55 +0800
Subject: [PATCH] 修改板卡操作配置基类复数化

---
 src/Bro.UI.Config/MenuForms/FrmOperation.cs |   15 ++++++++-------
 1 files changed, 8 insertions(+), 7 deletions(-)

diff --git a/src/Bro.UI.Config/MenuForms/FrmOperation.cs b/src/Bro.UI.Config/MenuForms/FrmOperation.cs
index 891d678..025c4fb 100644
--- a/src/Bro.UI.Config/MenuForms/FrmOperation.cs
+++ b/src/Bro.UI.Config/MenuForms/FrmOperation.cs
@@ -140,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)
             {
@@ -157,11 +157,11 @@
                 //if (Process.ProcessState != EnumHelper.DeviceState.DSOpen)
                 if (isStart)
                 {
-                    ProcessOperation(true);
+                    await ProcessOperation(true);
                 }
                 else
                 {
-                    ProcessOperation(false);
+                    await ProcessOperation(false);
                 }
 
                 isStart = !isStart;
@@ -172,7 +172,8 @@
             }
             finally
             {
-                this.BeginInvoke(new Action(() => btnStart.Enabled = true));
+                //this.BeginInvoke(new Action(() => btnStart.Enabled = true));
+                btnStart.Enabled = true;
             }
             //});
         }
@@ -255,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(() =>
                 //{
@@ -273,7 +274,7 @@
             }
             else
             {
-                Process.Close();
+                await Task.Run(() => Process.Close());
 
                 //this.BeginInvoke(new Action(() =>
                 //{

--
Gitblit v1.8.0