private void HandleHotkey(Hotkey hotkey) { if (window.Visibility != Visibility.Visible) { window.Collapse(); if (hotkey.Equals(displayHotkey)) Execute(); else if (hotkey.Equals(killHotkey)) killApplication(); } if (hotkey.Equals(displayHotkey) || hotkey.Equals(unchangeableDisplayHotkey)) window.Activate(); }
private int IndexOf(Hotkey item) { if (item.id > 0 && hotkeys.ContainsKey(item.id)) return item.id; if (hotkeys.ContainsValue(item)) { foreach (var k in hotkeys) { if (item.Equals(k.Value)) { item.id = k.Value.id; return item.id; } } } throw new ArgumentOutOfRangeException(string.Format("The hotkey \"{0}\" is not in this hotkey manager.", item)); }