private void btn_Save_Click(object sender, EventArgs e) { WindowsHelper.Hotkey Validator = GetHotkeyFromControls(); if (Validator.Modifiers == WindowsHelper.KeyModifier.None || Validator.Key == Keys.None) { this.existingHotkey = null; this.Hotkey = null; this.Close(); return; } if (!Validator.Validate()) { MessageBox.Show("One or more settings is invalid", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); return; } if (!isNew) { this.existingHotkey = GetHotkeyFromControls(); this.Hotkey = GetHotkeyFromControls(); this.Close(); } else { this.Hotkey = GetHotkeyFromControls(); this.Close(); } }
public frm_HotkeyEditor() { InitializeComponent(); isNew = true; populateCharacterCombobox(); this.Hotkey = new WindowsHelper.Hotkey(); combo_Character.DataSource = availableKeys; UpdateControls(); }
public frm_HotkeyEditor(WindowsHelper.Hotkey Hotkey) { InitializeComponent(); isNew = false; populateCharacterCombobox(); this.existingHotkey = Hotkey; this.Hotkey = Hotkey.Clone(); combo_Character.DataSource = availableKeys; UpdateControls(); }