private void btnSet_Click(object sender, EventArgs e) { if (lv.SelectedItems.Count == 0) { MessageBox.Show("No shortcut is currently selected!", "Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } ListViewItem item = lv.SelectedItems[0]; ScriptEditorActions action = (ScriptEditorActions)Enum.Parse(typeof(ScriptEditorActions), item.Text); Keys result = CreateKeysFromUserInput(); item.Tag = result; item.SubItems[1].Text = ScriptEditorShortcutKeysProvider.ShortcutKeysAsStringFromKeys(result); _isModified = true; if (_newShortcuts.ContainsKey(action)) { _newShortcuts[action] = result; } else { _newShortcuts.Add(action, result); } }
private void LoadFrom(SerializableDictionary <ScriptEditorActions, Keys> source) { lv.Items.Clear(); Array values = Enum.GetValues(typeof(ScriptEditorActions)); foreach (ScriptEditorActions action in source.Keys) { ListViewItem item = lv.Items.Add(action.ToString()); item.SubItems.Add(ScriptEditorShortcutKeysProvider.ShortcutKeysAsStringFromKeys(source[action])); item.Tag = source[action]; } }