private void addConfigurationButton_Click(object sender, EventArgs e) { var addConfig = new AddConfiguration(); var result = addConfig.ShowDialog(); if (result == System.Windows.Forms.DialogResult.OK) { Program.configManager.AddConfiguration(addConfig.configNameTextBox.Text); activeConfigurationComboBox.SelectedIndex = activeConfigurationComboBox.Items.Count - 2; } }
private void OnRequireNewConfig() { var addConfig = new AddConfiguration(); var result = addConfig.ShowDialog(); if (result == System.Windows.Forms.DialogResult.OK) { Program.configManager.AddConfiguration(addConfig.configNameTextBox.Text); activeConfigurationComboBox.SelectedIndex = activeConfigurationComboBox.Items.Count - 2; } else if (result == System.Windows.Forms.DialogResult.Cancel) { Application.Exit(); } }
private void activeConfigurationComboBox_SelectedIndexChanged(object sender, EventArgs e) { if (activeConfigurationComboBox.SelectedIndex == activeConfigurationComboBox.Items.Count - 1) { var addConfig = new AddConfiguration(); var result = addConfig.ShowDialog(); if (result == System.Windows.Forms.DialogResult.OK) { Program.configManager.AddConfiguration(addConfig.configNameTextBox.Text); activeConfigurationComboBox.SelectedIndex = activeConfigurationComboBox.Items.Count - 2; } else if (result == System.Windows.Forms.DialogResult.Cancel) { activeConfigurationComboBox.SelectedIndex = lastSelectedConfigurationIndex; } } else { Program.configManager.SetActiveConfiguration(activeConfigurationComboBox.SelectedItem.ToString()); SyncAll(); lastSelectedConfigurationIndex = activeConfigurationComboBox.SelectedIndex; } }