2 次代码提交 68abecdcdb ... 9d8e06525c

作者 SHA1 备注 提交日期
  刘彬 9d8e06525c Merge branch 'master' of http://49.235.130.76/LN/LPLocalhostMES 2 周之前
  刘彬 07ca107a2e 检查有没有AS启动 2 周之前
共有 1 个文件被更改,包括 11 次插入8 次删除
  1. 11 8
      LocalhostMES/App.xaml.cs

+ 11 - 8
LocalhostMES/App.xaml.cs

@@ -52,21 +52,24 @@ namespace LocalhostMES
             try
             {
                 var systemSettingsViewModel = Container.Resolve<SystemSettingsViewModel>();
-                systemSettingsViewModel.SaveSettings();
                 systemSettingsViewModel.StartService();
-
+                systemSettingsViewModel.SaveSettings();
                 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;
         protected override void OnStartup(StartupEventArgs e)
         {
-           
+
 
             mutex = new System.Threading.Mutex(true, "LocalhostMes_CRNS");
             if ( mutex.WaitOne(0, false) )
@@ -79,9 +82,9 @@ namespace LocalhostMES
                 this.Shutdown();
             }
         }
- 
 
-       
+
+
     }
 }