public AutoUpdateSettings(Main mainForm)
 {
     InitializeComponent();
     this.DialogResult = DialogResult.Cancel;
     _main = mainForm;
     chkAutoUpdate.Checked = Properties.Settings.Default.AutoUpdate;
     chkDocUpdates.Checked = Properties.Settings.Default.DoDocCheck;
     chkBeta.Checked = Properties.Settings.Default.BetaUpdates;
     foreach (string server in Properties.Settings.Default.UpdateServers)
     {
         lstServers.Items.Add(server);
     }
     //btnUpdate.Enabled = !Globals.EMMAUpdateServer.Equals("");
     if (UserAccount.Settings.UseLocalTimezone)
     {
         rdbLocalTime.Checked = true;
     }
     else
     {
         rdbEveTime.Checked = true;
     }
     chkGridCalcEnabled.Checked = UserAccount.Settings.GridCalcEnabled;
     cmbAssetsViewWarning.Text = UserAccount.Settings.AssetsViewWarning;
     chkShowInTaskbar.Checked = UserAccount.Settings.ShowInTaskbarWhenMinimised;
     chkExtendedDiags.Checked = UserAccount.Settings.ExtendedDiagnostics;
 }
Esempio n. 2
0
        static void Main(string[] args)
        {
            bool checkForUpdates = true;
            for (int i = 0; i < args.Length; i++)
            {
                if (args[i].Equals("/u"))
                {
                    try
                    {
                        checkForUpdates = bool.Parse(args[i + 1]);
                    }
                    catch
                    {
                        checkForUpdates = true;
                    }
                }
            }

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            try
            {
                Main main = new Main(checkForUpdates);
                if(!main.IsDisposed)
                {
                    Application.Run(main);
                }
            }
            catch (Exception ex)
            {
                // Creating new exception will cause error to be logged.
                EMMAException emmaex = ex as EMMAException;
                if (emmaex == null)
                {
                    emmaex = new EMMAException(ExceptionSeverity.Critical, "Unhandled exception", ex);
                }
                MessageBox.Show("An unexpected error has occured.\r\nCheck " + Globals.AppDataDir + "Logging\\ExceptionLog.txt" +
                    " for details.", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error);

                try
                {
                    // Attempt to logout. This will save all settings, etc.
                    UserAccount.Logout();
                }
                catch (Exception ex2)
                {
                    EMMAException emmaex2 = ex2 as EMMAException;
                    if (emmaex2 == null)
                    {
                        emmaex2 = new EMMAException(ExceptionSeverity.Critical,
                            "Error during automatic log out", ex2);
                    }
                }

                // Close the application. In some cases it may still be able to continue but it's
                // much safer to just shut things down.
                Application.Exit();
            }
        }