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 = "服务未启动";