コード例 #1
0
 private void addSwipeRecognizer()
 {
     SwipeGestureRecognizer = new MotionSwipeGestureRecognizer();
     SwipeGestureRecognizer.setMotionSwipeListener(this);
     SwipeGestureRecognizer.NumberOfFingersPerHandRequired = 4;
     SwipeGestureRecognizer.NumberOfHandsRequired          = 1;
     SwipeGestureRecognizer.possibleDirections             = MotionSwipeGestureRecognizerDirection.MotionSwipeGestureRecognizerDirectionUp | MotionSwipeGestureRecognizerDirection.MotionSwipeGestureRecognizerDirectionDown | MotionSwipeGestureRecognizerDirection.MotionSwipeGestureRecognizerDirectionLeft | MotionSwipeGestureRecognizerDirection.MotionSwipeGestureRecognizerDirectionRight;
     SwipeGestureRecognizer.startListening();
 }
コード例 #2
0
 private void addSwipeRecognizer()
 {
     SwipeGestureRecognizer = new MotionSwipeGestureRecognizer();
     SwipeGestureRecognizer.setMotionSwipeListener(this);
     SwipeGestureRecognizer.NumberOfFingersPerHandRequired = 4;
     SwipeGestureRecognizer.NumberOfHandsRequired = 1;
     SwipeGestureRecognizer.possibleDirections = MotionSwipeGestureRecognizerDirection.MotionSwipeGestureRecognizerDirectionUp | MotionSwipeGestureRecognizerDirection.MotionSwipeGestureRecognizerDirectionDown | MotionSwipeGestureRecognizerDirection.MotionSwipeGestureRecognizerDirectionLeft | MotionSwipeGestureRecognizerDirection.MotionSwipeGestureRecognizerDirectionRight;
     SwipeGestureRecognizer.startListening();
 }
コード例 #3
0
        //******Handlers***********

        public void motionDidSwipe(MotionSwipeGestureRecognizer recognizer)
        {
            if (recognizer.state == MotionGestureRecognizerState.MotionGestureRecognizerStateBegan)
            {
                System.Console.WriteLine("Swipe did Begin");
            }
            else if (recognizer.state == MotionGestureRecognizerState.MotionGestureRecognizerStateChanged)
            {
                //System.Console.WriteLine("Swipe did Change");
            }
            else if (recognizer.state == MotionGestureRecognizerState.MotionGestureRecognizerStateEnded)
            {
                //Handle swipe end
                if (recognizer.direction == MotionSwipeGestureRecognizerDirection.MotionSwipeGestureRecognizerDirectionLeft)
                {
                    System.Console.WriteLine("Swipe Left");
                }
                else if (recognizer.direction == MotionSwipeGestureRecognizerDirection.MotionSwipeGestureRecognizerDirectionRight)
                {
                    System.Console.WriteLine("Swipe Right");
                }
                else if (recognizer.direction == MotionSwipeGestureRecognizerDirection.MotionSwipeGestureRecognizerDirectionUp)
                {
                    //An example of how to handle multiple gestures of the same type
                    if (recognizer.identifier == SwipeGestureRecognizer.identifier)
                    {
                        System.Console.WriteLine("Swipe Up");
                    }
                }
                else if (recognizer.direction == MotionSwipeGestureRecognizerDirection.MotionSwipeGestureRecognizerDirectionDown)
                {
                    if (recognizer.identifier == SwipeGestureRecognizer.identifier)
                    {
                        System.Console.WriteLine("Swipe Down");
                    }
                }
            }
        }
コード例 #4
0
        //******Handlers***********

        public void motionDidSwipe(MotionSwipeGestureRecognizer recognizer)
        {
            if (recognizer.state == MotionGestureRecognizerState.MotionGestureRecognizerStateBegan)
            {
                System.Console.WriteLine("Swipe did Begin");
            }
            else if (recognizer.state == MotionGestureRecognizerState.MotionGestureRecognizerStateChanged)
            {
                //System.Console.WriteLine("Swipe did Change");
            }
            else if (recognizer.state == MotionGestureRecognizerState.MotionGestureRecognizerStateEnded)
            {
                //Handle swipe end
                if (recognizer.direction == MotionSwipeGestureRecognizerDirection.MotionSwipeGestureRecognizerDirectionLeft)
                {
                    System.Console.WriteLine("Swipe Left");
                }
                else if (recognizer.direction == MotionSwipeGestureRecognizerDirection.MotionSwipeGestureRecognizerDirectionRight)
                {
                    System.Console.WriteLine("Swipe Right");
                }
                else if (recognizer.direction == MotionSwipeGestureRecognizerDirection.MotionSwipeGestureRecognizerDirectionUp)
                {
                    //An example of how to handle multiple gestures of the same type
                    if (recognizer.identifier == SwipeGestureRecognizer.identifier)
                    {
                        System.Console.WriteLine("Swipe Up");
                    }
                }
                else if (recognizer.direction == MotionSwipeGestureRecognizerDirection.MotionSwipeGestureRecognizerDirectionDown)
                {
                    if (recognizer.identifier == SwipeGestureRecognizer.identifier)
                    {
                        System.Console.WriteLine("Swipe Down");
                    }
                }
            }
        }