Exemplo n.º 1
0
        private static void Main(string[] args)
        {
            bool startMinimized = false;

            if (args.Length > 0)
            {
                if (args[0].Equals("--start-minimized", StringComparison.CurrentCultureIgnoreCase))
                {
                    startMinimized = true;
                }
            }

            // Ensure only one copy of the application is running at a time
            using (var program = ProgramSingleInstance.Start())
            {
                if (program.IsOnlyInstance)
                {
                    Application.EnableVisualStyles();
                    Application.SetCompatibleTextRenderingDefault(false);
                    Application.ThreadException += OnApplicationThreadException;

                    mainForm = new MainForm(startMinimized);
                    Application.Run(mainForm);
                }
                else if (!startMinimized)
                {
                    program.ShowFirstInstance();
                }
            }
        }
Exemplo n.º 2
0
        private static void Main()
        {
            // Ensure only one copy of the application is running at a time
            using (var program = ProgramSingleInstance.Start())
            {
                if (program.IsOnlyInstance)
                {
                    Application.EnableVisualStyles();
                    Application.SetCompatibleTextRenderingDefault(false);
                    Application.ThreadException += OnApplicationThreadException;

                    mainForm = new MainForm();
                    Application.Run(mainForm);
                }
                else
                {
                    program.ShowFirstInstance();
                }
            }
        }