Esempio n. 1
0
 private void DelayedPasteCommand(object sender, DelayerActionEventArgs <object> e)
 {
     if (DisplayBarCommand.CanExecute(null))
     {
         DisplayBarCommand.Execute(null);
     }
 }
Esempio n. 2
0
 private void MouseAndKeyboardHookService_HotKeyDetected(object sender, HotKeyEventArgs e)
 {
     if (DisplayBarCommand.CanExecute(null))
     {
         Logger.Instance.Information($"The keyboard shortcut has hit.");
         e.Handled = true;
         _delayedPasteCommand.ResetAndTick();
     }
 }
Esempio n. 3
0
        private void MouseAndKeyboardHookService_MouseAction(object sender, MouseHookEventArgs e)
        {
            switch (Settings.Default.PasteBarPosition)
            {
            case PasteBarPosition.Top:
                if (e.WheelAction == MouseWheelAction.WheelDown)
                {
                    var activeScreen = Screen.FromPoint(new System.Drawing.Point(System.Windows.Forms.Cursor.Position.X, System.Windows.Forms.Cursor.Position.Y));
                    var screen       = SystemInfoHelper.GetAllScreenInfos().Single(s => s.DeviceName == activeScreen.DeviceName);

                    if (e.Coords.Y <= screen.Bounds.Top + 5 && DisplayBarCommand.CanExecute(null))
                    {
                        e.Handled = true;
                        Logger.Instance.Information($"Mouse gesture detected at the top of the screen.");
                        _delayedPasteCommand.ResetAndTick();
                    }
                }
                break;

            case PasteBarPosition.Bottom:
                if (e.WheelAction == MouseWheelAction.WheelUp)
                {
                    var activeScreen = Screen.FromPoint(new System.Drawing.Point(System.Windows.Forms.Cursor.Position.X, System.Windows.Forms.Cursor.Position.Y));
                    var screen       = SystemInfoHelper.GetAllScreenInfos().Single(s => s.DeviceName == activeScreen.DeviceName);

                    if (e.Coords.Y >= screen.Bounds.Bottom + screen.Bounds.Top - 5 && DisplayBarCommand.CanExecute(null))
                    {
                        e.Handled = true;
                        Logger.Instance.Information($"Mouse gesture detected at the bottom of the screen.");
                        _delayedPasteCommand.ResetAndTick();
                    }
                }
                break;

            default:
                throw new ArgumentOutOfRangeException();
            }
        }