|
@@ -52,21 +52,24 @@ namespace LocalhostMES
|
|
|
try
|
|
try
|
|
|
{
|
|
{
|
|
|
var systemSettingsViewModel = Container.Resolve<SystemSettingsViewModel>();
|
|
var systemSettingsViewModel = Container.Resolve<SystemSettingsViewModel>();
|
|
|
- systemSettingsViewModel.SaveSettings();
|
|
|
|
|
systemSettingsViewModel.StartService();
|
|
systemSettingsViewModel.StartService();
|
|
|
-
|
|
|
|
|
|
|
+ systemSettingsViewModel.SaveSettings();
|
|
|
Container.Resolve<SystemSettingsViewModel>().StartService();
|
|
Container.Resolve<SystemSettingsViewModel>().StartService();
|
|
|
- Process.Start(@"D:\HANS LASER\TeamAAS-VP.exe");
|
|
|
|
|
|
|
+ bool isRunning = Process.GetProcessesByName("TeamAAS-VM").Length > 0;
|
|
|
|
|
+ if ( !isRunning )
|
|
|
|
|
+ {
|
|
|
|
|
+ Process.Start(@"D:\HANS LASER\TeamAAS-VP.exe");
|
|
|
|
|
+ }
|
|
|
}
|
|
}
|
|
|
- catch (Exception ex)
|
|
|
|
|
|
|
+ catch ( Exception ex )
|
|
|
{
|
|
{
|
|
|
- MessageBox.Show( $"启动自动初始化系统设置失败: {ex.Message}");
|
|
|
|
|
|
|
+ MessageBox.Show($"启动自动初始化系统设置失败: {ex.Message}");
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
private static System.Threading.Mutex mutex;
|
|
private static System.Threading.Mutex mutex;
|
|
|
protected override void OnStartup(StartupEventArgs e)
|
|
protected override void OnStartup(StartupEventArgs e)
|
|
|
{
|
|
{
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
|
|
|
|
|
mutex = new System.Threading.Mutex(true, "LocalhostMes_CRNS");
|
|
mutex = new System.Threading.Mutex(true, "LocalhostMes_CRNS");
|
|
|
if ( mutex.WaitOne(0, false) )
|
|
if ( mutex.WaitOne(0, false) )
|
|
@@ -79,9 +82,9 @@ namespace LocalhostMES
|
|
|
this.Shutdown();
|
|
this.Shutdown();
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
-
|
|
|
|
|
|
|
|
|
|
-
|
|
|
|
|
|
|
+
|
|
|
|
|
+
|
|
|
}
|
|
}
|
|
|
}
|
|
}
|
|
|
|
|
|