private void conClear_Click(object sender, EventArgs e) { ActionCode action = (ActionCode)lstShortcuts.SelectedItems[0].Tag; Shortcut shortcut = new Shortcut(action, Keys.None); ShortcutActions.SetShortcuts(shortcut); applyShortcutChange(lstShortcuts.SelectedItems[0], shortcut); }
private void butReset_Click(object sender, EventArgs e) { ActionCode action = (ActionCode)lstShortcuts.SelectedItems[0].Tag; Shortcut shortcut = new Shortcut(action, Shortcuts.GetDefaultKeys(action)); ShortcutActions.SetShortcuts(shortcut); applyShortcutChange(lstShortcuts.SelectedItems[0], shortcut); }
private void applyShortcutChange(ListViewItem item, Shortcut shortcut) { string[] stringArray = shortcut.ToStringArray(); for (int i = 0; i < stringArray.Length; i++) { item.SubItems[i] = new ListViewItem.ListViewSubItem(item, stringArray[i]); } item.Tag = shortcut.Action; lblShortcut.Text = shortcut.KeysString; this.Invalidate(); }
private void editShortcut(ListViewItem selectedItem) { ActionCode action = (ActionCode)selectedItem.Tag; HotKeyInputForm hotKeyInputForm = new HotKeyInputForm(ShortcutActions[action].Keys) { DescriptionText = selectedItem.SubItems[0].Text, ModifiersRequired = false, }; if (hotKeyInputForm.ShowDialog() == DialogResult.OK) { Shortcut shortcut = new Shortcut(action, hotKeyInputForm.SelectedKeys); ShortcutActions.SetShortcuts(shortcut); applyShortcutChange(selectedItem, shortcut); } }