public static void Run(Form mainForm, string[] commandLine, StartupNextInstanceEventHandler startUpNextInstanceEventHandler, ShutdownEventHandler shutdownEventHandler)
 {
     SingleInstanceApplication app = new SingleInstanceApplication();
     if (startUpNextInstanceEventHandler != null) app.StartupNextInstance += startUpNextInstanceEventHandler;
     if (shutdownEventHandler != null) app.Shutdown += shutdownEventHandler;
     if (mainForm != null) app.MainForm = mainForm;
     app.Run(commandLine);
     app.OnShutdown();
 }
        static public void Run(ITunesHandler handler, Form mainForm, string[] commandLine)
        {
            Application.ThreadException += new System.Threading.ThreadExceptionEventHandler(Application_ThreadException);

            StartupNextInstanceEventHandler startupNextInstanceEventHandler = new StartupNextInstanceEventHandler(app_StartupNextInstance);
            ShutdownEventHandler            shutdownEventHandler            = new ShutdownEventHandler(app_Shutdown);

            SingleInstanceApplication.Run(mainForm, commandLine, startupNextInstanceEventHandler, shutdownEventHandler);
        }
        public static void Run(Form mainForm, string[] commandLine, StartupNextInstanceEventHandler startUpNextInstanceEventHandler, ShutdownEventHandler shutdownEventHandler)
        {
            SingleInstanceApplication app = new SingleInstanceApplication();

            if (startUpNextInstanceEventHandler != null)
            {
                app.StartupNextInstance += startUpNextInstanceEventHandler;
            }
            if (shutdownEventHandler != null)
            {
                app.Shutdown += shutdownEventHandler;
            }
            if (mainForm != null)
            {
                app.MainForm = mainForm;
            }
            app.Run(commandLine);
            app.OnShutdown();
        }