private void tsmiSettings_Click(object sender, EventArgs e) { using (var dialog = new ConfigurationForm(mConfiguration)) { if (dialog.ShowDialog() == DialogResult.OK) { SaveConfiguration(); Initialize(); } } }
private static GuiConfig ReconfigureConfiguration(string reason) { if (reason != null) { MessageBox.Show(reason, "Invalid configuration.", MessageBoxButtons.OK); } // Force the user to configure properly var configuration = new GuiConfig(); using (var dialog = new ConfigurationForm(configuration)) { DialogResult result = dialog.ShowDialog(); if (result != DialogResult.OK) { MessageBox.Show("You must specify a valid configuration for the program to be able to run. The program will now exit."); Environment.Exit(-1); } } return(configuration); }