コード例 #1
0
        static void Main(params string[] arguments)
        {
            MainForm oForm = null;
            bool     bInstanceFlag;

            Mutex MyApplicationMutex = new Mutex(true, "CalculationOilPrice_Mutex", out bInstanceFlag);

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            //Application.Run(new MainForm());

            if (!bInstanceFlag)
            {
                oForm = new MainForm();
                SingleInstanceApplication.Run(oForm, NewInstanceHandler);
            }
            else
            {
                oForm = new MainForm(arguments);
                SingleInstanceApplication.Run(oForm, NewInstanceHandler);
                oForm.Close();
            }

            //_MainForm = new MainForm();
            //SingleInstanceApplication.Run(_MainForm, NewInstanceHandler);
        }
コード例 #2
0
ファイル: Program.cs プロジェクト: karpiyon/lightningstools
        public static void Main(string[] args)
        {
            if (PriorProcess() != null)
            {
                return;
            }
            // Add the event handler for handling UI thread exceptions to the event.
            Application.ThreadException += UIThreadException;

            // Set the unhandled exception mode to force all Windows Forms errors to go through
            // our handler.
            Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException);

            // Add the event handler for handling non-UI thread exceptions to the event.
            AppDomain.CurrentDomain.UnhandledException +=
                CurrentDomain_UnhandledException;

            // ensure only a single instance of this app runs.
            var app = new SingleInstanceApplication();

            app.StartupNextInstance += OnAppStartupNextInstance;
            app.UnhandledException  += App_UnhandledException;
            _mainForm = new frmMain {
            };
            Control.CheckForIllegalCrossThreadCalls = false;
            if (Settings.Default.SettingsUpgradeNeeded)
            {
                Settings.Default.Upgrade();
                Settings.Default.SettingsUpgradeNeeded = false;
                Settings.Default.Save();
            }
            app.Run(_mainForm);
        }
コード例 #3
0
ファイル: Program.cs プロジェクト: Jonny007-MKD/Trigger4Win
        static void Main()
        {
            Application.EnableVisualStyles();

            Application.SetCompatibleTextRenderingDefault(false);
            SingleInstanceApplication.Run(new Main(), NewInstanceHandler);
        }
コード例 #4
0
ファイル: Program.cs プロジェクト: kanyun157/adbfile
 public static void Run(Form f, Microsoft.VisualBasic.ApplicationServices.StartupNextInstanceEventHandler startupHandler)
 {
     SingleInstanceApplication app = new SingleInstanceApplication();
     app.MainForm = f;
     app.StartupNextInstance += startupHandler;
     app.Run(Environment.GetCommandLineArgs());
 }
コード例 #5
0
 protected override bool OnStartup(Microsoft.VisualBasic.ApplicationServices.StartupEventArgs e)
 {
     // First time app is launched
     app = new SingleInstanceApplication();
     app.Run();
     return(false);
 }
コード例 #6
0
 public static void Run(Form form, StartupNextInstanceEventHandler startupHandler)
 {
     SingleInstanceApplication app = new SingleInstanceApplication();
     app.MainForm = form;
     app.StartupNextInstance += startupHandler;
     app.Run(Environment.GetCommandLineArgs());
 }
コード例 #7
0
    public static void Run(Form f, StartupNextInstanceEventHandler startupHandler)
    {
        SingleInstanceApplication app = new SingleInstanceApplication();

        app.MainForm             = f;
        app.StartupNextInstance += startupHandler;
        app.Run(Environment.GetCommandLineArgs());
    }
コード例 #8
0
 protected override bool OnStartup(Microsoft.VisualBasic.ApplicationServices.StartupEventArgs eventArgs)
 {
     // First time _application is launched
     _commandLine = eventArgs.CommandLine;
     _application = new SingleInstanceApplication();
     _application.Run();
     return(false);
 }
コード例 #9
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);
 }
コード例 #10
0
 public static void Run(Form form)
 {
     _application = new SingleInstanceApplication {
         MainForm = form
     };
     _application.StartupNextInstance += NextInstanceHandler;
     _application.Run(Environment.GetCommandLineArgs());
 }
コード例 #11
0
    public static void Run(Form f, StartupNextInstanceEventHandler startupHandler)
    {
        SingleInstanceApplication app = new SingleInstanceApplication();

        app.MainForm             = f;
        app.StartupNextInstance += startupHandler;
        app.Run(new string[0]);
    }
コード例 #12
0
         static void Main(params string[] Arguments)
         {
             Application.EnableVisualStyles();
             Application.SetCompatibleTextRenderingDefault(false);
             mainForm = new MainForm(Arguments);
             SingleInstanceApplication.Run(mainForm, NewInstanceHandler);
 
         }
コード例 #13
0
        static void StartApplication()
        {
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            var application = new SingleInstanceApplication(new Yal(hasMutex));

            application.StartupNextInstance += (sender, e) => { e.BringToForeground = true; };
            application.Run(Environment.GetCommandLineArgs());
        }
コード例 #14
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());
     }
 }
コード例 #15
0
ファイル: Program.cs プロジェクト: shalien/QuickPrint
            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());
            }
コード例 #16
0
ファイル: Program.cs プロジェクト: maihcx/IDesign
        static void Main(string[] args)
        {
            //Properties.Settings.Default.FUser = "";
            //Properties.Settings.Default.FUser = "";
            //Properties.Settings.Default.FIsFirsStart = false;
            //Properties.Settings.Default.Save();
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            CefSharpSettings.SubprocessExitIfParentProcessClosed = true;
            Cef.EnableHighDPISupport();
            var settings = new CefSettings()
            {
                CachePath = Path
                            .Combine(Environment
                                     .GetFolderPath(Environment.SpecialFolder.LocalApplicationData), "MessengerFB\\Cache")
            };

            settings.CefCommandLineArgs.Add("debug-plugin-loading", "1");
            settings.CefCommandLineArgs.Add("allow-outdated-plugins", "1");
            settings.CefCommandLineArgs.Add("always-authorize-plugins", "1");
            settings.CefCommandLineArgs.Add("disable-web-security", "1");
            settings.CefCommandLineArgs.Add("enable-npapi", "1");
            settings.CefCommandLineArgs.Add("enable-media-stream", "1");
            settings.CefCommandLineArgs.Add("enable_spellchecking", "0");
            settings.WindowlessRenderingEnabled = true;
            //settings.EnableNetSecurityExpiration = true;
            settings.BackgroundColor = Cef.ColorSetARGB(255, 85, 85, 85);
            if (Properties.Settings.Default.FStopGPU)
            {
                settings.SetOffScreenRenderingBestPerformanceArgs();
                settings.DisableGpuAcceleration();
            }
            settings.Locale             = "vi";
            settings.AcceptLanguageList = "en_US";
            Cef.Initialize(settings, performDependencyCheck: true, browserProcessHandler: null);

            //Application.Run(new frmMain());

            if (Properties.Settings.Default.FIsFirsStart)
            {
                frm = new frmMain();
                SingleInstanceApplication.Run(frm, NewInstanceHandler);
            }
            else
            {
                frm = new frmLogin();
                SingleInstanceApplication.Run(frm, NewInstanceHandler);
            }

            //frm1 = new frmIconTray();
            //SingleInstanceApplication.Run(frm1, NewInstanceHandlerNone);
            //Application.Run(new frmIconTray());
        }
コード例 #17
0
ファイル: Program.cs プロジェクト: shalien/QuickPrint
 private static void Main(params string[] args)
 {
     Application.EnableVisualStyles();
     Application.SetCompatibleTextRenderingDefault(false);
     _mainForm = new PrinterForm
     {
         WindowState = FormWindowState.Minimized
     };
     _mainForm.Hide();
     SingleInstanceApplication.Run(new PrinterForm(), NewInstanceHandler);
 }
コード例 #18
0
    public static void Run(Form form)
    {
        var app = new SingleInstanceApplication
        {
            MainForm = form
        };

        app.StartupNextInstance += (s, e) => e.BringToForeground = true;

        app.Run(Environment.GetCommandLineArgs());
    }
コード例 #19
0
        public static void Main()
        {
            // Add the event handler for handling UI thread exceptions to the event.
            Application.ThreadException += UIThreadException;

            // Set the unhandled exception mode to force all Windows Forms errors to go through
            // our handler.
            Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException);

            // Add the event handler for handling non-UI thread exceptions to the event.
            AppDomain.CurrentDomain.UnhandledException +=
                CurrentDomain_UnhandledException;

            Thread.CurrentThread.CurrentCulture   = new CultureInfo("en-us");
            Thread.CurrentThread.CurrentUICulture = new CultureInfo("en-us");
            Thread.CurrentThread.Name             = "MainThread";

            if (Settings.Default.UpgradeNeeded)
            {
                try
                {
                    Settings.Default.Upgrade();
                    Settings.Default.UpgradeNeeded = false;
                    Settings.Default.Save();
                }
                catch (Exception e)
                {
                    Settings.Default.Reset();
                    Settings.Default.UpgradeNeeded = false;
                    Settings.Default.Save();
                    MessageBox.Show(
                        "Error: Could not import settings from previous installation of " + Application.ProductName +
                        ".\nThis can happen if the configuration file was incorrectly edited by hand.\nDefault settings will be used instead.",
                        Application.ProductName, MessageBoxButtons.OK, MessageBoxIcon.Error,
                        MessageBoxDefaultButton.Button1);
                    _log.Error(e.Message, e);
                }
            }
            // ensure only a single instance of this app runs.
            var app = new SingleInstanceApplication();

            app.StartupNextInstance += OnAppStartupNextInstance;
            app.UnhandledException  += App_UnhandledException;
            if (Settings.Default.PollEveryNMillis < 20)
            {
                Settings.Default.PollEveryNMillis = 20;
                Settings.Default.Save();
            }

            mainForm = new frmMain();
            app.Run(mainForm);
        }
コード例 #20
0
        /// <summary>
        /// Replaces the Application.Run method.
        /// </summary>
        /// <param name="view">The view to run.</param>
        /// <param name="args"></param>
        public static void Run(ISingleInstanceApplicationView view, params string[] args)
        {
            if (mView != null)
            {
                throw new InvalidOperationException("Run has already been called in this application scope.");
            }

            mView = view;

            SingleInstanceApplication app = new SingleInstanceApplication(mView.MainWindow);

            app.StartupNextInstance += new StartupNextInstanceEventHandler(app_StartupNextInstance);
            app.Startup             += new StartupEventHandler(app_Startup);
            app.Run(args);
        }
コード例 #21
0
ファイル: Program.cs プロジェクト: Jonny007-MKD/Trigger4Win
            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());
            }
コード例 #22
0
        static void Main()
        {
            Global.Init(DefineTerminal.getOEMName());


            //Application.Run(new BRB.Forms.frmWaresScan());
            //SingleInstanceApplication.Run(new Forms.frmDocGrid(TypeDoc.SupplyLogistic));
            //SingleInstanceApplication.Run(new Forms.frmWaresGrid(TypeDoc.SupplyLogistic, 3699652));
            SingleInstanceApplication.Run(new Forms.frmMain());
            //SingleInstanceApplication.Run(new Forms.frmDocSearch());
            //SingleInstanceApplication.Run(new Forms.frmAdvSettingsDoc());
            //SingleInstanceApplication.Run(new Forms.frmTest());
            //SingleInstanceApplication.Run(new Forms.frmWaresScan());
            //SingleInstanceApplication.Run(new Forms.frmAbout());
            //SingleInstanceApplication.Run(new Forms.frmSettings());
        }
コード例 #23
0
ファイル: Program.cs プロジェクト: DOSSTONED/testPrograms
        static void Main()
        {
            // ensure only a single instance of this app runs.

            SingleInstanceApplication app = new SingleInstanceApplication();

            app.StartupNextInstance += new StartupNextInstanceEventHandler(OnAppStartupNextInstance);



            mainForm = new GameManager();

            app.Run(mainForm);
            //Application.EnableVisualStyles();
            //Application.SetCompatibleTextRenderingDefault(false);
        }
コード例 #24
0
ファイル: Program.cs プロジェクト: Jonny007-MKD/Trigger4Win
            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());
            }
コード例 #25
0
    static void Main(params string[] Arguments)
    {
        Form1 MainForm;
        bool  bInstanceFlag;
        Mutex MyApplicationMutex = new Mutex(true, "MyApp_Mutex", out bInstanceFlag);

        Application.EnableVisualStyles();
        Application.SetCompatibleTextRenderingDefault(false);

        if (!bInstanceFlag)
        {
            MainForm = new Form1();
            SingleInstanceApplication.Run(MainForm, NewInstanceHandler);
        }
        else
        {
            MainForm = new Form1();
            SingleInstanceApplication.Run(MainForm, NewInstanceHandler);
            MainForm.Close();
        }
    }
コード例 #26
0
        static void Main(params string[] Arguments)
        {
            bool  bInstanceFlag;
            Mutex mutex = new Mutex(true, "Sonic Downloader", out bInstanceFlag);

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            if (!bInstanceFlag)
            {
                MainForm = new Form1();
                SingleInstanceApplication.Run(MainForm, NewInstanceHandler);
            }
            else
            {
                MainForm = new Form1();
                SingleInstanceApplication.Run(MainForm, NewInstanceHandler);
                MainForm.notifyIcon1.Visible = false;
                MainForm.Close();
            }
        }
コード例 #27
0
ファイル: Program.cs プロジェクト: ahmetsait/LF2.IDE
        static void Main(string[] args)
        {
            try
            {
                MainForm.stopWatch = System.Diagnostics.Stopwatch.StartNew();
                Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException);
                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(true);

                using (MainForm = new MainForm(args))
                    SingleInstanceApplication.Run(MainForm, NewInstanceHandler);
            }
            catch (Exception ex)
            {
                string nl = Environment.NewLine;
                File.AppendAllText(exeDir + "\\FatalError.log", ex.ToString() + nl + nl, Encoding.Default);
                Process.Start(exeDir + "\\FatalError.log");
            }
            finally
            {
                MainForm.stopWatch.Reset();
            }
        }
コード例 #28
0
ファイル: Program.cs プロジェクト: ahmetsait/Patient-Recorder
        static void Main()
        {
            try
            {
                Application.SetUnhandledExceptionMode(UnhandledExceptionMode.CatchException);
                Application.EnableVisualStyles();
                Application.SetCompatibleTextRenderingDefault(true);

                using (MainForm = new FormMain())
                {
                    SingleInstanceApplication.Run(MainForm, NewInstanceHandler);
                }
            }
            catch (Exception ex)
            {
                string nl = Environment.NewLine;
                File.AppendAllText(fatalErrorPath, ex.ToString() + nl + nl, Encoding.Default);
                Process.Start(fatalErrorPath);
            }
            finally
            {
            }
        }
コード例 #29
0
        static void Main(string[] args)
        {
            Application.EnableVisualStyles();
            // Format DateTime theo US
            CultureInfo culture = new CultureInfo("en-US", true)
            {
                DateTimeFormat =
                {
                    ShortDatePattern = "yyyy/MM/dd",
                    LongDatePattern  = "yyyy/MM/dd HH:mm:ss",
                    LongTimePattern  = "HH:mm:ss",
                    DateSeparator    = "/"
                }
            };

            Application.CurrentCulture = culture;
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);

            //Karaoke_1.Properties.Settings.Default.strConnect = "Server=.;Database=Karaoke;Trusted_Connection=True";
            //Karaoke_1.Properties.Settings.Default.strConnect = "";
            //Karaoke_1.Properties.Settings.Default.Save();

            bool Check = BUS.BUS_NameServer.Instance.Check_Connect(Karaoke_1.Properties.Settings.Default.strConnect);

            if (Check == true)
            {
                frm = new frmLogin();
            }
            else
            {
                frm = new frmConnect();
            }

            SingleInstanceApplication.Run(frm, NewInstanceHandler);
        }
コード例 #30
0
ファイル: App.xaml.cs プロジェクト: nhnchengdu/nGit
            protected override bool OnStartup(Microsoft.VisualBasic.ApplicationServices.StartupEventArgs e)
            {
                // First time app is launched
                base.OnStartup(e);
                app = new SingleInstanceApplication();
                app.Run();

                return false;
            }
コード例 #31
0
 protected override bool OnStartup(Microsoft.VisualBasic.ApplicationServices.StartupEventArgs e)
 {
     app = new SingleInstanceApplication();
     app.Run();
     return false;
 }
コード例 #32
0
 static void Main()
 {
     Application.EnableVisualStyles();
     Application.SetCompatibleTextRenderingDefault(false);
     SingleInstanceApplication.Run(new Form1(), StartupNextInstanceEventHandler);
 }
コード例 #33
0
 static void Main(params string[] Arguments)
 {
     SingleInstanceApplication.Run(new ControlPanel(), NewInstanceHandler);
 }