Exemplo n.º 1
0
        void CommonHandler(object sender, TouchActionType touchActionType, PointerRoutedEventArgs args)
        {
            PointerPoint pointerPoint = args.GetCurrentPoint(sender as UIElement);

            // Get mouse button used
            TouchMouseButton touchMouseButton = TouchMouseButton.Unknown;

            if (pointerPoint.Properties != null)
            {
                if (pointerPoint.Properties.IsLeftButtonPressed)
                {
                    touchMouseButton = TouchMouseButton.Left;
                }
                if (pointerPoint.Properties.IsMiddleButtonPressed)
                {
                    touchMouseButton = TouchMouseButton.Middle;
                }
                if (pointerPoint.Properties.IsRightButtonPressed)
                {
                    touchMouseButton = TouchMouseButton.Right;
                }
            }

            Windows.Foundation.Point windowsPoint = pointerPoint.Position;

            onTouchAction(Element, new TouchActionEventArgs(args.Pointer.PointerId,
                                                            touchActionType,
                                                            new Point(windowsPoint.X, windowsPoint.Y),
                                                            args.Pointer.IsInContact,
                                                            touchMouseButton));
        }
 public TouchActionEventArgs(long id, TouchActionType type, Point location, bool isInContact, TouchMouseButton touchMouseButton = TouchMouseButton.Unknown)
 {
     Id          = id;
     Type        = type;
     Location    = location;
     IsInContact = isInContact;
     MouseButton = touchMouseButton;
 }