Exemplo n.º 1
0
        //Android only, routed args
        void CommonHandler(object sender, Android.Views.View.TouchEventArgs args)
        {
            var evnt = args.Event;
            var actn = args.Event.Action;
            // Get the pointer index
            int pointer_count = evnt.PointerCount;

            // Get the id to identify a finger over the course of its progress
            switch (actn & MotionEventActions.Mask)
            {
            case MotionEventActions.Scroll:
                var delta = evnt.GetAxisValue(Axis.Vscroll);
                effect.ScrollHandler(sender, GetPoint(args, pointer_count), (int)delta, (uint)pointer_count);
                break;

            case MotionEventActions.Down:
            case MotionEventActions.PointerDown:
                for (var i = 0; i < pointer_count; ++i)
                {
                    effect.PressedHandler(sender, GetPoint(args, i), (uint)i);
                }
                break;

            case MotionEventActions.Move:
            case MotionEventActions.HoverMove:
            case MotionEventActions.HoverEnter:
                for (var i = 0; i < pointer_count; ++i)
                {
                    effect.MoveHandler(sender, GetPoint(args, i), (uint)i);
                }
                break;

            case MotionEventActions.HoverExit:
            case MotionEventActions.PointerUp:
            case MotionEventActions.Up:
            case MotionEventActions.Cancel:
                for (var i = 0; i < pointer_count; ++i)
                {
                    effect.ReleasedHandler(sender, GetPoint(args, i), (uint)i);
                }
                break;
            }
        }
Exemplo n.º 2
0
 void PressedHandler(object sender, PointerRoutedEventArgs args)
 {
     effect.PressedHandler(sender, GetPoint(sender, args), args.Pointer.PointerId);
 }