예제 #1
0
        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);
        }
예제 #2
0
        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);
        }
예제 #3
0
 public void Can_parse_multikey_windows_play()
 {
     Check.That(KeyCombinationConverter.ParseShortcut("Windows + MediaPlayPause").Keys).ContainsExactly(Key.LWin, Key.MediaPlayPause);
 }
예제 #4
0
 public void Can_parse_multikey_windows()
 {
     Check.That(KeyCombinationConverter.ParseShortcut("Windows + I").Keys).ContainsExactly(Key.LWin, Key.I);
 }
예제 #5
0
 public void Can_parse_multikey_control_alt()
 {
     Check.That(KeyCombinationConverter.ParseShortcut("Control + Alt + I").Keys).ContainsExactly(Key.LeftCtrl, Key.LeftAlt, Key.I);
 }
예제 #6
0
 public void Can_parse_single_key_symbol()
 {
     Check.That(KeyCombinationConverter.ParseShortcut("Control").Keys).ContainsExactly(Key.LeftCtrl);
 }
예제 #7
0
 public void Can_parse_single_key()
 {
     Check.That(KeyCombinationConverter.ParseShortcut("A").Keys).ContainsExactly(Key.A);
 }
예제 #8
0
 public void Can_parse_spaces()
 {
     Check.That(KeyCombinationConverter.ParseShortcut("  ").Keys).IsEmpty();
 }
예제 #9
0
 public void Can_parse_null()
 {
     Check.That(KeyCombinationConverter.ParseShortcut(null).Keys).IsEmpty();
 }