private static void Main() { Process currentProc = Process.GetCurrentProcess(); foreach (Process proc in Process.GetProcessesByName(currentProc.ProcessName)) { if (proc.Id != currentProc.Id) { ShowWindow(proc.MainWindowHandle, SW_RESTORE); SetForegroundWindow(proc.MainWindowHandle); return; // Exit application } } Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); var view = new MainForm(); ScriptCore.IScriptManager sm = new ScriptCore.ScriptManager(); var presenter = new MainPresenter(view, sm); Application.Run(view); }
private static void Main() { Process currentProc = Process.GetCurrentProcess(); foreach (Process proc in Process.GetProcessesByName(currentProc.ProcessName)) { if (proc.Id != currentProc.Id) { ShowWindow(proc.MainWindowHandle, SW_RESTORE); SetForegroundWindow(proc.MainWindowHandle); return; // Exit application } } Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); var view = new MainForm(); ScriptCore.IScriptManager sm = new ScriptCore.ScriptManager(); var presenter = new MainPresenter(view, sm); Application.Run(view); }