private void settingsBtn_Click(object sender, EventArgs e) { using (SettingsEditor sEditor = new SettingsEditor()) { sEditor.Text = string.Format("{0} - [Settings Editor]", Application.ProductName); sEditor.Value = settingsProvider.Data; if (sEditor.ShowDialog() == System.Windows.Forms.DialogResult.OK) { bool isSaved = false; settingsProvider.Data = sEditor.Value; try { settingsProvider.Save(settingsFileName); isSaved = true; } catch (Exception ex) { ProcessException(ex, true); } if ((isSaved) && (MessageBox.Show("Settings saved. Restart application to apply new settings?", "Question", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.Yes)) { isRestart = true; Application.Restart(); } } } }
private void settingsBtn_Click(object sender, EventArgs e) { bool isSaved = false; using (SettingsEditor sEditor = new SettingsEditor()) { sEditor.Value = settingsProvider.Data; if (sEditor.ShowDialog() == System.Windows.Forms.DialogResult.OK) { settingsProvider.Data = sEditor.Value; try { settingsProvider.Save(settingsFileName); isSaved = true; } catch (Exception ex) { MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } } if ((isSaved) && (MessageBox.Show("Settings saved. Restart application to apply new settings?", "Question", MessageBoxButtons.YesNo, MessageBoxIcon.Question) == System.Windows.Forms.DialogResult.Yes)) { Application.Restart(); } }