public ShellViewModel( Func<HintSession, OverlayViewModel> overlayFactory, Func<HintSession, DebugOverlayViewModel> debugOverlayFactory, IHintProviderService hintProviderService, IDebugHintProviderService debugHintProviderService, IWindowManager windowManager, Func<OptionsViewModel> optionsVmFactory, IKeyListenerService keyListener) { _overlayFactory = overlayFactory; _debugOverlayFactory = debugOverlayFactory; _keyListener = keyListener; _windowManager = windowManager; _hintProviderService = hintProviderService; _debugHintProviderService = debugHintProviderService; _optionsVmFactory = optionsVmFactory; _keyListener.HotKey = new HotKey { Keys = Keys.OemSemicolon, Modifier = KeyModifier.Alt }; #if DEBUG _keyListener.DebugHotKey = new HotKey { Keys = Keys.OemSemicolon, Modifier = KeyModifier.Alt | KeyModifier.Shift }; #endif _keyListener.OnHotKeyActivated += _keyListener_OnHotKeyActivated; _keyListener.OnDebugHotKeyActivated += _keyListener_OnDebugHotKeyActivated; }
public static HintSession EnumHints <THint>(this IHintProviderService <THint> hintProviderService) where THint : Hint { var foregroundWindow = User32.GetForegroundWindow(); if (foregroundWindow == IntPtr.Zero) { return(null); } return(EnumHints(hintProviderService, foregroundWindow)); }
public static HintSession EnumHints <THint>(this IHintProviderService <THint> hintProviderService, IntPtr hWnd) where THint : Hint { Stopwatch sw = new Stopwatch(); sw.Start(); var session = EnumWindowHints(hWnd, hintProviderService.CreateHint); sw.Stop(); Debug.WriteLine("Enumeration of hints took {0} ms", sw.ElapsedMilliseconds); return(session); }
public ShellViewModel( Action <OverlayViewModel> showOverlay, Action <DebugOverlayViewModel> showDebugOverlay, Action <OptionsViewModel> showOptions, IHintLabelService hintLabelService, IHintProviderService <Hint> hintProviderService, IHintProviderService <DebugHint> debugHintProviderService, IKeyListenerService keyListener) { _showOverlay = showOverlay; _showDebugOverlay = showDebugOverlay; _showOptions = showOptions; _hintLabelService = hintLabelService; var keyListener1 = keyListener; _hintProviderService = hintProviderService; _debugHintProviderService = debugHintProviderService; keyListener1.HotKey = new HotKey { Keys = Keys.OemSemicolon, Modifier = KeyModifier.Alt }; keyListener1.TaskbarHotKey = new HotKey { Keys = Keys.OemSemicolon, Modifier = KeyModifier.Control }; #if DEBUG keyListener1.DebugHotKey = new HotKey { Keys = Keys.OemSemicolon, Modifier = KeyModifier.Alt | KeyModifier.Shift }; #endif keyListener1.OnHotKeyActivated += _keyListener_OnHotKeyActivated; keyListener1.OnTaskbarHotKeyActivated += _keyListener_OnTaskbarHotKeyActivated; keyListener1.OnDebugHotKeyActivated += _keyListener_OnDebugHotKeyActivated; ShowOptionsCommand = new DelegateCommand(ShowOptions); ExitCommand = new DelegateCommand(Exit); }
public ShellViewModel( Func <HintSession, OverlayViewModel> overlayFactory, IHintProviderService hintProviderService, IWindowManager windowManager, Func <OptionsViewModel> optionsVmFactory, IKeyListenerService keyListener) { _overlayFactory = overlayFactory; _keyListener = keyListener; _windowManager = windowManager; _hintProviderService = hintProviderService; _optionsVmFactory = optionsVmFactory; _keyListener.HotKey = new HotKey { Keys = System.Windows.Forms.Keys.OemSemicolon, Modifier = KeyModifier.Alt }; _keyListener.OnHotKeyActivated += _keyListener_OnHotKeyActivated; }