private void InitializeShortcutDetector() { _detector = new KeyboardShortcutDetectorFactory().Create(); _detector.RegisterShortcut(new LeftCtrlDigitShortcut()); _detector.RegisterShortcut(new RightCtrlLetterShortcut()); _detector.Subscribe(this); }
internal static void RestartOnCtrlAltDel(this IKeyboardShortcutDetector detector) { detector.RegisterShortcut(new CtrlAltDelShortcut()); detector.Subscribe(new ActionShortcutPressedObserver <CtrlAltDelShortcut>(shortcut => detector.Restart())); }
public static void ExecuteOnBoth <TShortcut>(this IKeyboardShortcutDetector detector, Action action) where TShortcut : class, IKeyboardShortcut { detector.Subscribe(new ActionShortcutObserver <TShortcut>(shortcut => action())); }
public static void ExecuteOnReleased <TShortcut>(this IKeyboardShortcutDetector detector, Action <TShortcut> action) where TShortcut : class, IKeyboardShortcut { detector.Subscribe(new ActionShortcutReleasedObserver <TShortcut>(action)); }
public void SetUp() { Keyboard = new KeyboardMock(); ShortcutDetector = new ShortcutDetector(Keyboard); }