From d4c486d9ba9c458315a4c84555ab2578e30ce4fc Mon Sep 17 00:00:00 2001 From: ZGGSONG Date: Sat, 21 May 2022 16:18:29 +0800 Subject: [PATCH] update --- ScadaTool/ViewModel/MainViewModel.cs | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/ScadaTool/ViewModel/MainViewModel.cs b/ScadaTool/ViewModel/MainViewModel.cs index d324847..ef804b5 100644 --- a/ScadaTool/ViewModel/MainViewModel.cs +++ b/ScadaTool/ViewModel/MainViewModel.cs @@ -63,9 +63,10 @@ namespace ScadaTool.ViewModel }); // 服务 + var isTrue = true; StartServiceCommand = new RelayCommand((_) => { - return true; + return isTrue; }, (_) => { string result = GoCSharpHelper.Instance().GoStringToCSharpString(run()); @@ -73,6 +74,7 @@ namespace ScadaTool.ViewModel { MessageBox.Show("服务启动\n" + result); icoPath = "Resources/icon.ico"; + isTrue = false; timer.Dispose(); } else @@ -82,16 +84,16 @@ namespace ScadaTool.ViewModel }); #endregion - } + #region Go /// /// 引入Go项目库 /// /// [DllImport("scadatool_go.dll", EntryPoint = "run")] extern static GoString run(); - + #endregion #region 属性 private string mToolTip = "服务未启动";