예제 #1
0
        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;
        }
예제 #2
0
        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));
        }
예제 #3
0
        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);
        }
예제 #4
0
        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);
        }
예제 #5
0
        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;
        }