Example #1
0
 public CustomApplication() :  base()
 {
     EnableVisualStyles    =  true;
     IsSingleInstance      =  true;
     MainForm              =  new MainForm();
     StartupNextInstance  +=  new StartupNextInstanceEventHandler(OnStartupNext);
 }
Example #2
0
 public static void Run(Form f, StartupNextInstanceEventHandler startupHandler)
 {
     SingleInstanceApplication app = new SingleInstanceApplication();
     app.MainForm = f;
     app.StartupNextInstance += startupHandler;
     app.Run(Environment.GetCommandLineArgs());
 }
Example #3
0
 public static void Run(Form f, StartupNextInstanceEventHandler startupHandler)
 {
     Form = f;
     var app = new SingleInstanceApplication { MainForm = f };
     app.StartupNextInstance += startupHandler;
     var args = Environment.GetCommandLineArgs();
     app.Run(args);
 }
            public App()
            {
                IsSingleInstance   = Properties.Settings.Default.singleInstance;
                EnableVisualStyles = true;

                ShutdownStyle        = ShutdownMode.AfterMainFormCloses;
                StartupNextInstance += new StartupNextInstanceEventHandler(SIApp_StartupNextInstance);
            }
Example #5
0
        public static void Run(Form mainForm, StartupNextInstanceEventHandler handler)
        {
            var starter = new SingleInstanceApplicationStarter();

            starter.MainForm             = mainForm;
            starter.StartupNextInstance += handler;
            starter.Run(Environment.GetCommandLineArgs());
        }
Example #6
0
    public static void Run(Form f, StartupNextInstanceEventHandler startupHandler)
    {
        SingleInstanceApplication app = new SingleInstanceApplication();

        app.MainForm             = f;
        app.StartupNextInstance += startupHandler;
        app.Run(new string[0]);
    }
Example #7
0
        public static void Run(Form f, StartupNextInstanceEventHandler startupHandler)
        {
            SingleInstanceApplication app = new SingleInstanceApplication();

            app.MainForm             = f;
            app.StartupNextInstance += startupHandler;
            app.Run(Environment.GetCommandLineArgs());
        }
Example #8
0
 public static void Run(Form form, StartupNextInstanceEventHandler startupHandler)
 {
     OneInstanceApp app = new OneInstanceApp();
     app.IsSingleInstance = true;
     app.MainForm = form;
     app.StartupNextInstance += startupHandler;
     app.Run(Environment.GetCommandLineArgs());
 }
Example #9
0
            public static void Run(Form f, StartupNextInstanceEventHandler startupHandler)
            {
                var app = new ProcessInit {
                    MainForm = f
                };

                app.StartupNextInstance += startupHandler;
                app.Run(Environment.GetCommandLineArgs());
            }
        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 Start(Form f, StartupNextInstanceEventHandler handler)
 {
     if (app == null && f != null)
     {
         app = new SingleInstanceApp(f);
     }
     app.StartupNextInstance += handler;
     app.Run(Environment.GetCommandLineArgs());
 }
        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);
        }
        // Construct SingleInstanceApp object, and invoke its run method.
        public static void Start(Form f, StartupNextInstanceEventHandler handler)
        {
            if (app == null && f != null)
                app = new SingleInstanceApp(f);

            // Wire up StartupNextInstance event handler.
            app.StartupNextInstance += handler;
            app.Run(Environment.GetCommandLineArgs());
        }
 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();
 }
Example #15
0
        public static void Run(Form form, StartupNextInstanceEventHandler startupHandler)
        {
            OneInstanceApp oneInstanceApp =
                new OneInstanceApp();

            oneInstanceApp.MainForm             = form;
            oneInstanceApp.StartupNextInstance += startupHandler;
            oneInstanceApp.Run(Environment.GetCommandLineArgs());
        }
Example #16
0
 public static void Run(RibbonForm f, StartupNextInstanceEventHandler startupHandler)
 {
     SingleInstanceApplication app = new SingleInstanceApplication();
     app.MainForm= f;
     if (f.DialogResult != DialogResult.Cancel)
     {
         app.StartupNextInstance += startupHandler;
         app.Run(Environment.GetCommandLineArgs());
     }
 }
Example #17
0
            public static void Run(Form form, StartupNextInstanceEventHandler startupHandler)
            {
                form.Hide();
                form.WindowState = FormWindowState.Minimized;
                var app = new SingleInstanceApplication {
                    MainForm = form
                };

                app.StartupNextInstance += startupHandler;
                app.Run(Environment.GetCommandLineArgs());
            }
Example #18
0
        public App()
        {
            // Make this a single-instance application
            IsSingleInstance   = true;
            EnableVisualStyles = true;

            // There are some other things available in the VB application model, for
            // instance the shutdown style:
            ShutdownStyle = ShutdownMode.AfterMainFormCloses;

            // Add StartupNextInstance handler
            StartupNextInstance += new StartupNextInstanceEventHandler(SIApp_StartupNextInstance);
        }
Example #19
0
            public static void Run(Form f, StartupNextInstanceEventHandler startupHandler)
            {
                SingleInstanceApplication app = new SingleInstanceApplication();
                app.MainForm = f;
                app.StartupNextInstance += startupHandler;

                Options options = new Options();

                if (!CommandLine.Parser.Default.ParseArguments(Environment.GetCommandLineArgs(), options))
                    Environment.Exit(CommandLine.Parser.DefaultExitCodeFail);

                app.Startup += new StartupEventHandler(((Main)f).Init);

                app.Run(Environment.GetCommandLineArgs());
            }
Example #20
0
            public static void Run(Form f, StartupNextInstanceEventHandler startupHandler)
            {
                SingleInstanceApplication app = new SingleInstanceApplication();

                app.MainForm             = f;
                app.StartupNextInstance += startupHandler;

                Options options = new Options();

                if (!CommandLine.Parser.Default.ParseArguments(Environment.GetCommandLineArgs(), options))
                {
                    Environment.Exit(CommandLine.Parser.DefaultExitCodeFail);
                }

                app.Startup += new StartupEventHandler(((Main)f).Init);

                app.Run(Environment.GetCommandLineArgs());
            }
        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();
        }
Example #22
0
        public SingleInstanceController()
        {
            IsSingleInstance = true;

            StartupNextInstance += new StartupNextInstanceEventHandler(SingleInstanceController_StartupNextInstance);
        }