Ejemplo n.º 1
0
        /// <summary>
        /// Quit application.
        /// </summary>
        public static void Quit()
        {
            // don't show shutdown question message
            _continueQuitting = true;

            // show shutdown notify
            Javascript.Run("showShutdownMessage();");

            // save configuration
            SMCConfiguration.Save();

            // shutdown application from thread
            var wait = new Thread(() =>
            {
                // shutdown working downloader
                Instance.SMCDownloader.ShutDownDownloader();

                // wait
                Thread.Sleep(800);

                // shutdown application
                Instance.Invoke((MethodInvoker) delegate
                {
                    Instance.Hide();
                    Browser.Dispose();
                    Cef.Shutdown();
                    Process.GetCurrentProcess().Kill();
                });
            });

            wait.Start();
        }
Ejemplo n.º 2
0
 private void SaveLaunchOptions()
 {
     SMCConfiguration.Loaded.UserName = textBoxUsername.Text;
     if (int.TryParse(textBoxRam.Text, out var ram))
     {
         SMCConfiguration.Loaded.UserRAM = ram;
     }
     SMCConfiguration.Save();
 }
Ejemplo n.º 3
0
        private void StartupWindow_Shown(object sender, EventArgs e)
        {
            var waitForMainWindow = new Thread(() => { Invoke((MethodInvoker) delegate
                {
                    SMCConfiguration.Load();
                    Thread.Sleep(1000);
                    Hide();
                    var mainWindow = new MainWindow();
                    mainWindow.Show();
                }); });

            waitForMainWindow.Start();
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Loads configuration.
        /// </summary>
        public static void Load()
        {
            if (File.Exists(ConfigurationPath))
            {
                try
                {
                    Loaded = JsonConvert.DeserializeObject <SMCConfiguration>(
                        JEMFile.LoadTextFromFile(ConfigurationPath));
                    return;
                }
                catch (Exception e)
                {
                    JEMLogger.LogException(e, "Failed to load SMCConfiguration file.");
                }
            }

            Loaded = new SMCConfiguration();
            Save();
        }