Handles gesture events
The handler simplifies handling gesture such as rotate, zoom and pan by keeping the requires knowledge of the previous and first event in the gesture event sequence.
Inheritance: Handler
Ejemplo n.º 1
0
        public MainForm()
        {
            InitializeComponent();

            Load += (s, e) => { _rect = new DrawingObject(this.Size); };
            SizeChanged += (s, e) => { if (_rect != null) _rect.ResetObject(this.Size); Invalidate(); };
            Paint += (s, e) => { if (_rect != null) _rect.Paint(e.Graphics); };

            _gestureHandler = Factory.CreateHandler<Windows7.Multitouch.GestureHandler>(this);

            _gestureHandler.Pan += ProcessPan;
            _gestureHandler.PanBegin += ProcessPan;
            _gestureHandler.PanEnd += ProcessPan;

            _gestureHandler.Rotate += ProcessRotate;
            _gestureHandler.RotateBegin += ProcessRotate;
            _gestureHandler.RotateEnd += ProcessRotate;

            _gestureHandler.PressAndTap += ProcessRollOver;

            _gestureHandler.TwoFingerTap += ProcessTwoFingerTap;

            _gestureHandler.Zoom += ProcessZoom;
            _gestureHandler.ZoomBegin += ProcessZoom;
            _gestureHandler.ZoomEnd += ProcessZoom;


        }
Ejemplo n.º 2
0
        public MainWindow()
        {
            InitializeComponent();

            if (!Windows7.Multitouch.TouchHandler.DigitizerCapabilities.IsMultiTouchReady)
            {
                MessageBox.Show("Multitouch is not availible");
                Environment.Exit(1);
            }

            _dropShadow.Color = Colors.Black;
            _dropShadow.Direction = 320;
            _dropShadow.ShadowDepth = 30;
            _dropShadow.BlurRadius = 1;
            _dropShadow.Opacity = 0.5;

            _blur.Radius = 10;

            Loaded += (s, e) => {  };
            SizeChanged += (s, e) => 
                {
                    _image.Width = e.NewSize.Width / 4; _image.Height = e.NewSize.Height/4;
                    Canvas.SetLeft(_image, e.NewSize.Width * 0.375);
                    Canvas.SetTop(_image, e.NewSize.Height * 0.375);
                };

            _gestureHandler = Factory.CreateGestureHandler(this);

            _gestureHandler.Pan += ProcessPan;
            _gestureHandler.PanBegin += ProcessPan;
            _gestureHandler.PanEnd += ProcessPan;

            _gestureHandler.Rotate += ProcessRotate;
            _gestureHandler.RotateBegin += ProcessRotate;
            _gestureHandler.RotateEnd += ProcessRotate;

            _gestureHandler.PressAndTap += ProcessRollOver;

            _gestureHandler.TwoFingerTap += ProcessTwoFingerTap;

            _gestureHandler.Zoom += ProcessZoom;
            _gestureHandler.ZoomBegin += ProcessZoom;
            _gestureHandler.ZoomEnd += ProcessZoom;

        }
Ejemplo n.º 3
0
        /// <summary>
        /// Create new gesture event instance and decode the gesture info structure
        /// </summary>
        /// <param name="handler">The gesture handler</param>
        /// <param name="gestureInfo">The gesture information</param>
        internal GestureEventArgs(GestureHandler handler, ref GESTUREINFO gestureInfo)
        {
            _dwFlags = gestureInfo.dwFlags;
            GestureId = gestureInfo.dwID;
            GestureArguments = gestureInfo.ullArguments;

            //Get the last event from the handler
            LastEvent = handler.LastEvent;

            //Get the last begin event from the handler
            LastBeginEvent = handler.LastBeginEvent;

            DecodeGesture(handler.HWndWrapper, ref gestureInfo);

            //new gesture, clear last and first event fields
            if (IsBegin)
            {
                LastBeginEvent = null;
                LastEvent = null;
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Create new gesture event instance and decode the gesture info structure
        /// </summary>
        /// <param name="handler">The gesture handler</param>
        /// <param name="gestureInfo">The gesture information</param>
        internal GestureEventArgs(GestureHandler handler, ref GESTUREINFO gestureInfo)
        {
            _dwFlags         = gestureInfo.dwFlags;
            GestureId        = gestureInfo.dwID;
            GestureArguments = gestureInfo.ullArguments;

            //Get the last event from the handler
            LastEvent = handler.LastEvent;

            //Get the last begin event from the handler
            LastBeginEvent = handler.LastBeginEvent;

            DecodeGesture(handler.HWndWrapper, ref gestureInfo);

            //new gesture, clear last and first event fields
            if (IsBegin)
            {
                LastBeginEvent = null;
                LastEvent      = null;
            }
        }
Ejemplo n.º 5
0
 public TouchGestureEdit()
 {
     InitializeComponent();
     _handler = Factory.CreateHandler<GestureHandler>(this);
     _handler.Pan += (s, e) => { UpdateValue(e); };
 }