Пример #1
0
        // Common handlers
        private void ScrollHandler(object sender, PointerRoutedEventArgs args)
        {
            var sndr  = sender as UIElement;
            var p     = args.GetCurrentPoint(sndr);
            var delta = p.Properties.MouseWheelDelta;
            var temp  = p.Position;
            var pt    = new Point(temp.X, temp.Y);

            effect.ScrollHandler(sender, GetPoint(sender, args), delta, args.Pointer.PointerId);
        }
Пример #2
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;
            }
        }