public static void ManageApp(string app, bool Shutdown) { Process[] processes; string File = "NONE"; if (app == "GUI") { app = "VGUI"; File = "V.exe"; } if (Shutdown) { #region " Kill Vertex GUI " try { processes = Process.GetProcessesByName(app); foreach (Process proc in processes) { proc.Kill(); proc.WaitForExit(5000); } } catch (System.NullReferenceException) {/* no instance running */} catch (Exception ex) { Console.WriteLine(app + " shutdown exception: " + ex.Message); } #endregion " Kill Vertex GUI " #region "Launch Vertex GUI Mimic" try { ProcessStartInfo proc1 = new ProcessStartInfo("Gui_Mimic.exe"); proc1.Arguments = @"C:\Program Files (x86)\Sp\Ver"; Process.Start(proc1); } catch (System.NullReferenceException) { } catch (Exception ex) { Console.WriteLine(app + " shutdown exception: " + ex.Message); } #endregion "Launch Vertex GUI Mimic" } else{ ..... Some things ..... } }
Process.Start(@"C:\Windows\notepad.exe");
var
This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)