private void add_Click(object sender, EventArgs e) { using (SingleKeybindEditor edit = new SingleKeybindEditor()) { edit.ShowDialog(); ApplyKeybindAfterEditing(edit, false, null); } }
private void edit_Click(object sender, EventArgs e) { Keybind toEdit = (Keybind)picker.SelectedItem; using (SingleKeybindEditor edit = new SingleKeybindEditor(toEdit)) { edit.ShowDialog(); ApplyKeybindAfterEditing(edit, true, toEdit); edit.Enabled = false; delete.Enabled = false; } }
private void ApplyKeybindAfterEditing(SingleKeybindEditor editor, bool edited, Keybind toReplace) { if (!editor.confirmed) { return; } Keybind kb = editor.keybind; if (edited) { Data.keybinds.ReplaceKeybind(toReplace, kb); } else { Data.keybinds.AddKeybind(kb); } UpdateBox(); }