예제 #1
0
        static void Main()
        {
            // Set SimpleLog properties
            SimpleLog.SetLogFile(logDir: ".\\Log", prefix: "SQS-Log_", writeText: true);

            // Close identical apps
            CloseIdenticalApps();

            // Upgrade settings if needed
            if (Properties.Settings.Default.UpgradeSettings)
            {
                Properties.Settings.Default.Upgrade();
                Properties.Settings.Default.UpgradeSettings = false;

                Properties.Settings.Default.Save();
                Properties.Settings.Default.Reload();
            }

            // Display update notification
            DisplayUpdateNotification();

            // Add methods to events
            Application.ApplicationExit += Application_ApplicationExit;

            // Check for available updates
            SquirrelHandler.CheckForUpdatesAsync();

            // Start Application
            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            AppDomain.CurrentDomain.AssemblyResolve += CurrentDomain_AssemblyResolve;
            mainForm = new MainForm();
            Application.Run(mainForm);
        }
예제 #2
0
        async static public void CloseApplicationPromt()
        {
            if (mainForm == null)
            {
                return;
            }

            // Promt user
            if (MessageBox.Show("Are you sure you want to quit SQS?",
                                "Steam Quick Switch", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button2) == DialogResult.No)
            {
                return;
            }

            // Close visuals
            mainForm.Hide();

            // Await Squirrel
            await SquirrelHandler.WaitForUpdatesOnShutdown();

            // Exit Application
            Application.Exit();
        }