示例#1
0
 private void tsmiSettings_Click(object sender, EventArgs e)
 {
     using (var dialog = new ConfigurationForm(mConfiguration))
     {
         if (dialog.ShowDialog() == DialogResult.OK)
         {
             SaveConfiguration();
             Initialize();
         }
     }
 }
示例#2
0
        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);
        }