EventArgs which define basic parrameters for a PointerDevice action.
상속: System.EventArgs
예제 #1
0
 void OnMouseDown( object sender, PointerDeviceEventArgs e )
 {
     if( IsRecording )
     {
         Console.WriteLine( "Mouse down recorded" );
         _recordCallback( new Trigger( MouseCodeFromButtonInfo( e.ButtonInfo, e.ExtraInfo ), TriggerDevice.Pointer ) );
         IsRecording = false;
     }
     else
     {
         FireKeyDown( MouseCodeFromButtonInfo( e.ButtonInfo, e.ExtraInfo ), e.Source == InputSource.CiviKey ? TriggerDevice.Civikey : TriggerDevice.Pointer );
     }
 }
 private void OnPointerButtonUp( object sender, PointerDeviceEventArgs e )
 {
     if( _windowMoved && !_timer.IsEnabled )
     {
         _timer.Start();
     }
 }
예제 #3
0
 void OnMouseLocationChanged( object sender, PointerDeviceEventArgs e )
 {
     UpdateLocation( e.X, e.Y );
 }
        void OnMouseMove( PointerDeviceEventArgs e )
        {
            if( _isDown )
            {
                Point position = new Point( _context.PointerDeviceDriver.Service.CurrentPointerXLocation, _context.PointerDeviceDriver.Service.CurrentPointerYLocation );

                if( ( _isDragging == false ) &&
                    ( ( Math.Abs( position.X - _startPoint.X ) > SystemParameters.MinimumHorizontalDragDistance ) ||
                    ( Math.Abs( position.Y - _startPoint.Y ) > SystemParameters.MinimumVerticalDragDistance ) ) )
                    _isDragging = true;

                if( _isDragging )
                {
                    X = (int)( position.X - ( _startPoint.X - _originalLeft ) );
                    Y = (int)( position.Y - ( _startPoint.Y - _originalTop ) );
                }
            }
        }
예제 #5
0
        /// <summary>
        /// Method which provides an interpretation for all hook events.
        /// Depending of the hook's params we'll fire the good event.
        /// </summary>
        private void OnHookInvoqued( object sender, MouseArgs e )
        {
            InputSource source;
            if ( (int)e.Infos.dwExtraInfo == 39229115 ) //CiviKey's footprint
                source = InputSource.CiviKey;
            else
                source = InputSource.Other;

            int x = e.Infos.pt.X;
            int y = e.Infos.pt.Y;

            switch ( e.MouseMessage )
            {
                case CK.InputDriver.Native.MouseMessage.WM_LBUTTONDBLCLK:
                    //if ( PointerButtonDoubleClick != null )
                    //{
                    //    PointerDeviceEventArgs args = new PointerDeviceEventArgs( x, y, ButtonInfo.DefaultButton, String.Empty, source );
                    //    PointerButtonDoubleClick( this, args );
                    //}
                    break;
                case CK.InputDriver.Native.MouseMessage.WM_LBUTTONDOWN:
                    if ( PointerButtonDown != null )
                    {
                        PointerDeviceEventArgs args = new PointerDeviceEventArgs( x, y, ButtonInfo.DefaultButton, String.Empty, source );
                        PointerButtonDown( this, args );
                    }
                    break;
                case CK.InputDriver.Native.MouseMessage.WM_LBUTTONUP:
                    if ( PointerButtonUp != null )
                    {
                        PointerDeviceEventArgs args = new PointerDeviceEventArgs( x, y, ButtonInfo.DefaultButton, String.Empty, source );
                        PointerButtonUp( this, args );
                    }
                    break;
                case CK.InputDriver.Native.MouseMessage.WM_MBUTTONDBLCLK:
                    //if ( PointerButtonDoubleClick != null )
                    //{
                    //    PointerDeviceEventArgs args = new PointerDeviceEventArgs( x, y, ButtonInfo.XButton, ButtonExtraInfo.Middle, source );
                    //    PointerButtonDoubleClick( this, args );
                    //}
                    break;
                case CK.InputDriver.Native.MouseMessage.WM_MBUTTONDOWN:
                    if ( PointerButtonDown != null )
                    {
                        PointerDeviceEventArgs args = new PointerDeviceEventArgs( x, y, ButtonInfo.XButton, ButtonExtraInfo.Middle, source );
                        PointerButtonDown( this, args );
                    }
                    break;
                case CK.InputDriver.Native.MouseMessage.WM_MBUTTONUP:
                    if ( PointerButtonUp != null )
                    {
                        PointerDeviceEventArgs args = new PointerDeviceEventArgs( x, y, ButtonInfo.XButton, ButtonExtraInfo.Middle, source );
                        PointerButtonUp( this, args );
                    }
                    break;
                case CK.InputDriver.Native.MouseMessage.WM_MOUSEHWHEEL:
                    if ( WheelAction != null )
                    {
                        WheelActionEventArgs args = new WheelActionEventArgs( x, y, ButtonInfo.XButton, ButtonExtraInfo.Middle, source, e.Infos.mouseData );
                        WheelAction( this, args );
                    }
                    break;
                case CK.InputDriver.Native.MouseMessage.WM_MOUSEMOVE:
                    _lastPointerPosition.X = x;
                    _lastPointerPosition.Y = y;
                    if ( PointerMove != null )
                    {
                        PointerDeviceEventArgs args = new PointerDeviceEventArgs( x, y, ButtonInfo.None, String.Empty, source );
                        PointerMove( this, args );
                    }
                    break;
                case CK.InputDriver.Native.MouseMessage.WM_MOUSEWHEEL:
                    if ( WheelAction != null )
                    {
                        WheelActionEventArgs args = new WheelActionEventArgs( x, y, ButtonInfo.XButton, ButtonExtraInfo.Middle, source, e.Infos.mouseData );
                        WheelAction( this, args );
                    }
                    break;
                case CK.InputDriver.Native.MouseMessage.WM_RBUTTONDBLCLK:
                    //if ( PointerButtonDoubleClick != null )
                    //{
                    //    PointerDeviceEventArgs args = new PointerDeviceEventArgs( x, y, ButtonInfo.XButton, ButtonExtraInfo.Right, source );
                    //    PointerButtonDoubleClick( this, args );
                    //}
                    break;
                case CK.InputDriver.Native.MouseMessage.WM_RBUTTONDOWN:
                    if ( PointerButtonDown != null )
                    {
                        PointerDeviceEventArgs args = new PointerDeviceEventArgs( x, y, ButtonInfo.XButton, ButtonExtraInfo.Right, source );
                        PointerButtonDown( this, args );
                    }
                    break;
                case CK.InputDriver.Native.MouseMessage.WM_RBUTTONUP:
                    if ( PointerButtonUp != null )
                    {
                        PointerDeviceEventArgs args = new PointerDeviceEventArgs( x, y, ButtonInfo.XButton, ButtonExtraInfo.Right, source );
                        PointerButtonUp( this, args );
                    }
                    break;
                case CK.InputDriver.Native.MouseMessage.WM_XBUTTONDBLCLK:
                    //if ( PointerButtonDoubleClick != null )
                    //{
                    //    PointerDeviceEventArgs args = new PointerDeviceEventArgs( x, y, ButtonInfo.XButton, ButtonExtraInfo.Unknown, source );
                    //    PointerButtonDoubleClick( this, args );
                    //}
                    break;
                case CK.InputDriver.Native.MouseMessage.WM_XBUTTONDOWN:
                    if ( PointerButtonDown != null )
                    {
                        PointerDeviceEventArgs args = new PointerDeviceEventArgs( x, y, ButtonInfo.XButton, ButtonExtraInfo.Unknown, source );
                        PointerButtonDown( this, args );
                    }
                    break;
                case CK.InputDriver.Native.MouseMessage.WM_XBUTTONUP:
                    if ( PointerButtonUp != null )
                    {
                        PointerDeviceEventArgs args = new PointerDeviceEventArgs( x, y, ButtonInfo.XButton, ButtonExtraInfo.Unknown, source );
                        PointerButtonUp( this, args );
                    }
                    break;
                default:
                    break;
            }

            //if ( args != null && args.Cancel )
            //    e.Cancel = true;
        }
예제 #6
0
 void OnPointerMove( object sender, PointerDeviceEventArgs e )
 {
     _mouseIndicatorWindow.Left = e.X + 10;
     _mouseIndicatorWindow.Top = e.Y - 20;
 }
 public void OnPointerButtonUp( PointerDeviceEventArgs args )
 {
     //Console.Out.WriteLine( "ButtonUp from Context" );
     StopDragging();
 }
예제 #8
0
 void OnPointerButtonDown( object sender, PointerDeviceEventArgs e )
 {
     if( _currentDevice == TriggerDevice.Pointer )
     {
         if( MouseCodeFromButtonInfo( e.ButtonInfo, e.ExtraInfo ) == _keyCode ) // when the right mouse button is pressed
         {
             if( InternalTriggered != null )
             {
                 //We don't cancel the event, in order no to block the user when he selects the left click as the trigger.
                 //e.Cancel = true;
                 InternalTriggered( this, new InputTriggerEventArgs( e.Source ) );
             }
         }
     }
 }
예제 #9
0
 void OnPointerButtonDown( object sender, PointerDeviceEventArgs e )
 {
     _keyboardTriggerConfig.User.Set( "TriggerCode", MouseCodeFromButtonInfo( e.ButtonInfo, e.ExtraInfo ) );
     _keyboardTriggerConfig.User.Set( "TriggerDevice", TriggerDevice.Pointer );
     NotifyOfPropertyChange( () => SelectedKey );
     if( IsRecording ) IsRecording = false;
 }
예제 #10
0
 public void TriggerMouseEvent( KeyboardEditorMouseEvent eventType, PointerDeviceEventArgs args )
 {
     switch( eventType )
     {
         case KeyboardEditorMouseEvent.MouseMove:
             OnMouseMove( args );
             break;
         case KeyboardEditorMouseEvent.PointerButtonUp:
             OnPointerButtonUp( args );
             break;
         case KeyboardEditorMouseEvent.PointerButtonDown:
             //Console.Out.WriteLine("Down from context");
             break;
         default: //ButtonDown is handler by a Command, we don't use the pointer device driver for that. (yet ?)
             break;
     }
 }
예제 #11
0
 void Service_PointerMove( object sender, PointerDeviceEventArgs e )
 {
     if( !_isActive ) _isActive = true;
 }
예제 #12
0
        /// <summary>
        /// Simulate a ButtonDown Event
        /// </summary>
        /// <param name="buttonInfo">Default button is Left, look at ButtonInfo to see available buttons</param>
        //public void SimulateButtonDown( ButtonInfo buttonInfo, string extraInfo )
        //{
        //    if( buttonInfo == ButtonInfo.DefaultButton )
        //        Win32Wrapper.mouse_event( MouseEventFlags.LEFTDOWN, 0, 0, 0, 0 );
        //    if( buttonInfo == ButtonInfo.XButton && extraInfo == ButtonExtraInfo.Right )
        //        Win32Wrapper.mouse_event( MouseEventFlags.RIGHTDOWN, 0, 0, 0, 0 );
        //    if( buttonInfo == ButtonInfo.XButton && extraInfo == ButtonExtraInfo.Middle )
        //        Win32Wrapper.mouse_event( MouseEventFlags.MIDDLEDOWN, 0, 0, 0, 0 );
        //}
        /// <summary>
        /// Simulate a ButtonUp Event
        /// </summary>
        /// <param name="buttonInfo">Default button is Left, look at ButtonInfo to see available buttons</param>
        //public void SimulateButtonUp( ButtonInfo buttonInfo, string extraInfo )
        //{
        //    if( buttonInfo == ButtonInfo.DefaultButton )
        //        Win32Wrapper.mouse_event( MouseEventFlags.LEFTUP, 0, 0, 0, 0 );
        //    if( buttonInfo == ButtonInfo.XButton && extraInfo == ButtonExtraInfo.Right )
        //        Win32Wrapper.mouse_event( MouseEventFlags.RIGHTUP, 0, 0, 0, 0 );
        //    if( buttonInfo == ButtonInfo.XButton && extraInfo == ButtonExtraInfo.Middle )
        //        Win32Wrapper.mouse_event( MouseEventFlags.MIDDLEUP, 0, 0, 0, 0 );
        //}
        /// <summary>
        /// Method which provides an interpretation for all hook events.
        /// Depending of the hook's params we'll fire the good event.
        /// </summary>
        private void OnHookInvoqued( object sender, HookEventArgs e )
        {
            MouseMessage mouseMessage = (MouseMessage)e.wParam.ToInt32();
            //If this is a mouse move and the pointerPosGetter is set, return, the hook should not process it.
            if( _pointerPosGetter != null && mouseMessage == MouseMessage.WM_MOUSEMOVE ) return;

            LLMouseHookStruct mouseInfo = (LLMouseHookStruct)Marshal.PtrToStructure( e.lParam, typeof( LLMouseHookStruct ) );
            MouseHookAction action = (MouseHookAction)e.Code;

            InputSource source = InputSource.Other;
            if( (int)mouseInfo.dwExtraInfo == 39229115 ) //CiviKey's footprint
            {
                source = InputSource.CiviKey;
            }

            // We only handle the hook if the hook proc contain informations
            if( action == MouseHookAction.HC_ACTION )
            {
                _lastPointerPosition.X = mouseInfo.pt.X;
                _lastPointerPosition.Y = mouseInfo.pt.Y;
                string buttonExtraInfo = String.Empty;
                ButtonInfo buttonInfo = GetButtonInfo( mouseMessage, out buttonExtraInfo );

                PointerDeviceEventArgs pointerEventArgs = new PointerDeviceEventArgs( _lastPointerPosition.X, _lastPointerPosition.Y, buttonInfo, buttonExtraInfo, source );

                // We look at the MouseMessage (wParam of the HookProc delegate) to know which event to fire.
                if( mouseMessage == MouseMessage.WM_MOUSEMOVE && InternalPointerMove != null )
                {
                    InternalPointerMove( this, pointerEventArgs );
                }
                else if( mouseMessage == MouseMessage.WM_LBUTTONDOWN ||
                    mouseMessage == MouseMessage.WM_MBUTTONDOWN ||
                    mouseMessage == MouseMessage.WM_RBUTTONDOWN )
                {
                    if( PointerButtonDown != null ) PointerButtonDown( this, pointerEventArgs );
                }
                else if( mouseMessage == MouseMessage.WM_LBUTTONUP ||
                    mouseMessage == MouseMessage.WM_MBUTTONUP ||
                    mouseMessage == MouseMessage.WM_RBUTTONUP )
                {
                    if( PointerButtonUp != null ) PointerButtonUp( this, pointerEventArgs );
                }

                // if a client wanted to cancel the current event we tell it to the WindowsHook procedure.
                if( pointerEventArgs.Cancel )
                    e.Cancel = true;
            }
        }
예제 #13
0
        //TODO test if the pointer is in the window
        void OnPointerButtonUp( object sender, PointerDeviceEventArgs e )
        {
            //DIRTYFIX
            //Allows the bypass the fact that Windows puts a window to the initial position
            //if the windows was moved during the PointerKeyUp treatment event
            if( _bindResult != null && _activationTimer == null )
            {
                _activationTimer = new DispatcherTimer();
                _activationTimer.Interval = new TimeSpan(0, 0, 0, 0, 50);
                _activationTimer.Tick += _activationTimer_Tick;
                _activationTimer.Start();
            }

            _pointerDownLock = true;
        }
예제 #14
0
 //avoids bind during window.Move()
 void OnPointerButtonDown( object sender, PointerDeviceEventArgs e )
 {
     _pointerDownLock = false;
 }