void TouchWindow_PreviewStylusMove(object sender, StylusEventArgs e)
        {
            lock (_moveLock)
            {
                if (!_touches.ContainsKey(e.StylusDevice.Id))
                {
                    var touchPointSize = TouchDetector.GetSizeFromStylusPoint(e.StylusDevice.GetStylusPoints(_element)[0]);
                    touchPointSize.Width  *= InputSizeScale;
                    touchPointSize.Height *= InputSizeScale;

                    var touchPoint = new GestureTouchPoint(e.StylusDevice, touchPointSize, e.GetPosition(_element), TouchAction.Down);

                    _touches.Add(e.StylusDevice.Id, touchPoint);

                    GestureTouchDown(_element, new GestureTouchEventArgs(e.StylusDevice.Id, touchPoint, e.Timestamp));
                }
                else
                {
                    if (_touchInputCounter[e.StylusDevice.Id]++ <= InputFilter)
                    {
                        return;
                    }

                    _touchInputCounter[e.StylusDevice.Id] = 0;

                    var touchPointSize = TouchDetector.GetSizeFromStylusPoint(e.StylusDevice.GetStylusPoints(_element)[0]);
                    touchPointSize.Width  *= InputSizeScale;
                    touchPointSize.Height *= InputSizeScale;

                    var touchPoint = new GestureTouchPoint(e.StylusDevice, touchPointSize, e.GetPosition(_element), TouchAction.Up);
                    GestureTouchMove(_element, new GestureTouchEventArgs(e.StylusDevice.Id, touchPoint, e.Timestamp));
                }
            }
        }
        void TouchWindow_PreviewStylusMove(object sender, StylusEventArgs e)
        {
            var touchPointSize = TouchDetector.GetSizeFromStylusPoint(e.StylusDevice.GetStylusPoints(this)[0]);
            var touchPoint     = new GestureTouchPoint(e.StylusDevice, touchPointSize, e.GetPosition(this), TouchAction.Up);

            GestureTouchMove(this, new GestureTouchEventArgs(e.StylusDevice.Id, touchPoint, e.Timestamp));
        }
        void TouchWindow_PreviewStylusDown(object sender, StylusDownEventArgs e)
        {
            var touchPointSize = TouchDetector.GetSizeFromStylusPoint(e.StylusDevice.GetStylusPoints(this)[0]);

            var touchPoint = new GestureTouchPoint(e.StylusDevice, touchPointSize, e.GetPosition(this), TouchAction.Down);

            _touches.AddOrUpdate(e.StylusDevice.Id, touchPoint,
                                 (key, oldValue) => touchPoint);

            GestureTouchDown(this, new GestureTouchEventArgs(e.StylusDevice.Id, touchPoint, e.Timestamp));
        }
        void _element_PreviewTouchUp(object sender, TouchEventArgs e)
        {
            if (!_touches.ContainsKey(e.TouchDevice.Id))
            {
                return;
            }

            var touchPointSize = new Size(0, 0);

            touchPointSize.Width  *= InputSizeScale;
            touchPointSize.Height *= InputSizeScale;
            var touchPoint = new GestureTouchPoint(e.TouchDevice, touchPointSize, e.GetTouchPoint(_element).Position, TouchAction.Up);

            GestureTouchUp(_element, new GestureTouchEventArgs(e.TouchDevice.Id, touchPoint, e.Timestamp));

            _touches.Remove(e.TouchDevice.Id);
        }
        void TouchWindow_PreviewStylusUp(object sender, StylusEventArgs e)
        {
            if (!_touches.ContainsKey(e.StylusDevice.Id))
            {
                return;
            }

            var touchPointSize = TouchDetector.GetSizeFromStylusPoint(e.StylusDevice.GetStylusPoints(this)[0]);

            var touchPoint = new GestureTouchPoint(e.StylusDevice, touchPointSize, e.GetPosition(this), TouchAction.Up);

            GestureTouchUp(this, new GestureTouchEventArgs(e.StylusDevice.Id, touchPoint, e.Timestamp));

            GestureTouchPoint dump;

            _touches.TryRemove(e.StylusDevice.Id, out dump);
        }
 public GestureTouchEventArgs(int id, GestureTouchPoint point, int time)
 {
     Id         = id;
     TouchPoint = point;
     Timestamp  = time;
 }