private static void SetCurrent(Key key, Hotkey hotkey) { if (CurrentHotkeys.ContainsKey(key)) { throw new Exception($"An active hotkey of that type '{key}' already exists. Prev priority: {CurrentHotkeys[key].Priority}, new priority: {hotkey.Priority}"); } CurrentHotkeys.Add(key, hotkey); }
public static bool IsBlocked(Key key) { if (CurrentHotkeys.ContainsKey(key)) { return(CurrentHotkeys[key].Block); } else { return(false); } }
public static bool KeyUp(Key key) { if (!CurrentHotkeys.ContainsKey(key)) { return(false); } var hotkey = CurrentHotkeys[key]; CurrentHotkeys.Remove(key); Task.Run(hotkey.KeyUp); return(hotkey.Block); }