From 98f849d9aa6d1db64337ea9c4eaba4f4dd4fde67 Mon Sep 17 00:00:00 2001
From: wells.liu <wells.liu@broconcentric.com>
Date: 星期二, 07 七月 2020 15:20:50 +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