Ejemplo n.º 1
0
        public static void Bind(Window window)
        {
            var componentManager = ServiceProvider.GetGlobalServiceAsync <SOleComponentManager, IOleComponentManager>().Result;
            var thief            = new KeystrokeThief(componentManager);

            new System.Windows.Interop.WindowInteropHelper(window).Owner = new IntPtr(CodistPackage.DTE.MainWindow.HWnd);
            window.Activated   += (s, args) => thief.StartStealing();
            window.Deactivated += (s, args) => thief.StopStealing();
            window.Closed      += (s, args) => thief.StopStealing();
        }
Ejemplo n.º 2
0
        public static void Bind(Window window)
        {
            ThreadHelper.ThrowIfNotOnUIThread();
            var componentManager = ServiceProvider.GetGlobalServiceAsync <SOleComponentManager, IOleComponentManager>().Result;
            var thief            = new KeystrokeThief(componentManager);

            // window.Owner = Application.Current.MainWindow;
            window.Activated   += (s, args) => thief.StartStealing();
            window.Deactivated += (s, args) => thief.StopStealing();
            window.Closed      += (s, args) => thief.StopStealing();
        }
Ejemplo n.º 3
0
        protected override void OnLostKeyboardFocus(KeyboardFocusChangedEventArgs e)
        {
            base.OnLostKeyboardFocus(e);

            if (_thief != null && _thief.IsStealing)
            {
                _thief.StopStealing();
            }
        }