Inheritance: PointerDeviceEventArgs
Ejemplo n.º 1
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;
        }
Ejemplo n.º 2
0
 private void OnWheelAction( object sender, WheelActionEventArgs e )
 {
 }