static void Main() { AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(CurrentDomain_UnhandledException); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); Application.SetUnhandledExceptionMode(UnhandledExceptionMode.ThrowException); using (SingleInstanceController siController = new SingleInstanceController()) { if (siController.RegisterNewInstance()) { frmMain mainForm = new frmMain(); siController.MainForm = mainForm; Application.Run(mainForm); } } }
public SIWindow(SingleInstanceController controller) { this.controller = controller; }