private static void RegisterKeyCombination(EventHandler <HotkeyEventArgs> handler, string shortcut, string name) { var startCombination = KeyCombinationConverter.ParseShortcut(shortcut); startCombination.CombinationToShortcut(out var key, out var modifiers); TryRegisterHotkey(name, key, modifiers, handler); }
protected override void OnViewAttached(object view, object context) { base.OnViewAttached(view, context); var preferences = preferencesSerializer.Load(); DebugAllShortcut = KeyCombinationConverter.ParseShortcut(preferences.DebugAllShortcut); StartAllShortcut = KeyCombinationConverter.ParseShortcut(preferences.StartAllShortcut); StopAllShortcut = KeyCombinationConverter.ParseShortcut(preferences.StopAllShortcut); }
public void Can_parse_multikey_windows_play() { Check.That(KeyCombinationConverter.ParseShortcut("Windows + MediaPlayPause").Keys).ContainsExactly(Key.LWin, Key.MediaPlayPause); }
public void Can_parse_multikey_windows() { Check.That(KeyCombinationConverter.ParseShortcut("Windows + I").Keys).ContainsExactly(Key.LWin, Key.I); }
public void Can_parse_multikey_control_alt() { Check.That(KeyCombinationConverter.ParseShortcut("Control + Alt + I").Keys).ContainsExactly(Key.LeftCtrl, Key.LeftAlt, Key.I); }
public void Can_parse_single_key_symbol() { Check.That(KeyCombinationConverter.ParseShortcut("Control").Keys).ContainsExactly(Key.LeftCtrl); }
public void Can_parse_single_key() { Check.That(KeyCombinationConverter.ParseShortcut("A").Keys).ContainsExactly(Key.A); }
public void Can_parse_spaces() { Check.That(KeyCombinationConverter.ParseShortcut(" ").Keys).IsEmpty(); }
public void Can_parse_null() { Check.That(KeyCombinationConverter.ParseShortcut(null).Keys).IsEmpty(); }