protected void btnOK_Clicked(object o, EventArgs args) { if (grid.EditedCell.IsValid && grid.EditedCell.Row < itemShortcuts.Count && !ShortcutColumnEvaluate(grid.EditedCell.Row, string.Empty)) { return; } BusinessDomain.QuickItems.Clear(); List <KeyValuePair <string, AccelKey> > changedShortcuts = new List <KeyValuePair <string, AccelKey> > (); foreach (ItemShortcut itemShortcut in itemShortcuts) { if (itemShortcut.ItemId < 0) { continue; } string accelPath = KeyShortcuts.GetAccelPath(itemShortcut.ItemId.ToString()); AccelMap.ChangeEntry(accelPath, (uint)itemShortcut.Shortcut.Key, KeyShortcuts.GetAllowedModifier(itemShortcut.Shortcut.AccelMods), true); if (itemShortcut.Shortcut.Key > 0) { string key = KeyShortcuts.KeyToString(itemShortcut.Shortcut.Key, itemShortcut.Shortcut.AccelMods); BusinessDomain.QuickItems.Add(key, itemShortcut.ItemName); } changedShortcuts.Add(new KeyValuePair <string, AccelKey> (accelPath, itemShortcut.Shortcut)); } KeyShortcuts.Save(changedShortcuts); dlgEditQuickItems.Respond(ResponseType.Ok); }
protected void btnOK_Clicked(object o, EventArgs args) { if (edited) { TryApplyShortcut(); BusinessDomain.FeedbackProvider.TrackEvent("Key shortcuts", "Edited"); } if (changedShortcuts.Count > 0) { if (Message.ShowDialog(Translator.GetString("Restart now?"), null, string.Format(Translator.GetString("In order for the change to take effect you need to restart {0}. Do you want to restart {0} now?"), DataHelper.ProductName), "Icons.Question32.png", MessageButtons.Restart | MessageButtons.Cancel) != ResponseType.Apply) { return; } KeyShortcuts.Save(changedShortcuts); PresentationDomain.QueueRestart(); } dlgEditKeyShortcuts.Respond(ResponseType.Ok); }