Example #1
0
        /// <summary>
        /// Attempts to save the settings. On catching an exception will prompt the user and close XC.
        /// </summary>
        public static void TrySaveSettings()
        {
            try
            {
                Properties.Settings.Default.Save();
            }
            catch (ConfigurationErrorsException ex)
            {
                // Show a warning to the user and exit the application.
                using (var dlg = new ThreeButtonDialog(
                           new ThreeButtonDialog.Details(
                               SystemIcons.Error,
                               string.Format(Messages.MESSAGEBOX_SAVE_CORRUPTED, Settings.GetUserConfigPath()),
                               Messages.MESSAGEBOX_SAVE_CORRUPTED_TITLE)
                           ))
                {
                    dlg.ShowDialog(Program.MainWindow);
                }

                log.Error("Could not save settings. Exiting application.");
                log.Error(ex, ex);
                Application.Exit();
            }

            HealthCheck.SendMetadataToHealthCheck();
        }