internal static Hotkey AddOrFind(HotkeyFunction hotkeyFunction) { var hkey = Program.settings.Hotkey.ToList().Find(x => x.Function == hotkeyFunction); if (hkey == null) Program.settings.Hotkey.Add(hkey = new Hotkey { Function = hotkeyFunction }); return hkey; }
public bool TryRegisterHotkey(string functionName, System.Action action, KeyCombo keyCombo) { // Toss out anything where the main key is a toggle key (not using the system correctly). foreach (var toggleKey in ToggleKey.GetAll()) { if (toggleKey.Keys.Contains(keyCombo.MainKey)) { Game.Log(Logging.Category.SONG_DATA, $"Unable to register hotkey: Main key (Keycode.{keyCombo.MainKey}) is a reserved toggle key.", Logging.Level.LOG_WARNING); return(false); } } if (_hotKeyRegistry.Exists(kvp => kvp.Key.Equals(keyCombo))) { // Keycode already registered. var existingHotkeyRegistryItem = _hotKeyRegistry.Find(kvp => kvp.Key.Equals(keyCombo)); Game.LogFormat(Logging.Category.SONG_DATA, "Unable to register hotkey: This key combo ({0}) is already reserved for the function: \"{1}\".", Logging.Level.LOG_WARNING, existingHotkeyRegistryItem.Key.GetSequenceString(), existingHotkeyRegistryItem.Value.FunctionName); return(false); } else { // Successful registration. var newHotkeyFunction = new HotkeyFunction(functionName, action); _hotKeyRegistry.Add(new KeyValuePair <KeyCombo, HotkeyFunction>(keyCombo, newHotkeyFunction)); } return(true); }
public Hotkey(HotkeyFunction function, ModifierKeys modifier, Key key) { this.Function = function; this.Key = key; this.ModifierKey = modifier; SetDefaultParameterValues(); }
internal static Hotkey AddOrFind(HotkeyFunction hotkeyFunction) { var hkey = Program.settings.Hotkey.ToList().Find(x => x.Function == hotkeyFunction); if (hkey == null) { Program.settings.Hotkey.Add(hkey = new Hotkey { Function = hotkeyFunction }); } return(hkey); }
public FunctionHotkey GetFunctionHotkey(HotkeyFunction function) { return(inputMan.GetFunctionHotkey(function)); }
public FunctionHotkey(ScanCode hkScan, Modifiers mods, HotkeyFunction function) : base(hkScan, mods) { Function = function; }