/// <summary>
        /// Manages what happens when the user completes a slide
        /// </summary>
        /// <param name="touches">Touches.</param>
        /// <param name="evt">Evt.</param>
        public override void TouchesEnded(NSSet touches, UIEvent evt)
        {
            base.TouchesEnded(touches, evt);

            if (CurrentActivePanelContainer == null)
            {
                return;
            }

            CGPoint touchPt;
            var touch = touches.AnyObject as UITouch;
            if (touch != null)
            {
                touchPt = touch.LocationInView(View);
            }
            else
            {
                return;
            }

            if (CurrentActivePanelContainer.SlidingEnded(touchPt, SlidingController.View.Frame))
            {
                if (ShowPanel != null)
                {
                    ShowPanel(this, new SlidingGestureEventArgs(CurrentActivePanelContainer));
                }
            }
            else
            {
                if (HidePanel != null)
                {
                    HidePanel(this, new SlidingGestureEventArgs(CurrentActivePanelContainer));
                }
            }
        }
        /// <summary>
        /// Manages what happens while the user is mid-slide
        /// </summary>
        /// <param name="touches">Touches.</param>
        /// <param name="evt">Evt.</param>
        public override void TouchesMoved(MonoTouch.Foundation.NSSet touches, UIEvent evt)
        {
            base.TouchesMoved(touches, evt);

            if (CurrentActivePanelContainer == null)
            {
                return;
            }

            PointF  touchPt;
            UITouch touch = touches.AnyObject as UITouch;

            if (touch != null)
            {
                touchPt = touch.LocationInView(this.View);
            }
            else
            {
                return;
            }

            RectangleF newFrame = CurrentActivePanelContainer.Sliding(touchPt, SlidingController.View.Frame);

            SlidingController.View.Frame = newFrame;
        }
        /// <summary>
        /// Manages what happens when the user begins a possible slide 
        /// </summary>
        /// <param name="touches">Touches.</param>
        /// <param name="evt">Evt.</param>
        public override void TouchesBegan(NSSet touches, UIEvent evt)
        {
            base.TouchesBegan(touches, evt);

            CGPoint touchPt;
            var touch = touches.AnyObject as UITouch;
            if (touch != null)
            {
                touchPt = touch.LocationInView(View);
            }
            else
            {
                State = UIGestureRecognizerState.Failed;
                return;
            }

            CurrentActivePanelContainer = _panelContainers.FirstOrDefault(p => p.IsVisible);
            if (CurrentActivePanelContainer == null)
            {
                CurrentActivePanelContainer = _panelContainers.FirstOrDefault(p => p.CanStartSliding(touchPt, SlidingController.View.Frame));
                if (CurrentActivePanelContainer != null)
                {
                    CurrentActivePanelContainer.Show();
                    CurrentActivePanelContainer.SlidingStarted(touchPt, SlidingController.View.Frame);
                }
                else
                {
                    State = UIGestureRecognizerState.Failed;
                }
            }
            else
            {
                CurrentActivePanelContainer.SlidingStarted(touchPt, SlidingController.View.Frame);
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        ///     Manages what happens while the user is mid-slide
        /// </summary>
        /// <param name="touches">Touches.</param>
        /// <param name="evt">Evt.</param>
        public override void TouchesMoved(NSSet touches, UIEvent evt)
        {
            base.TouchesMoved(touches, evt);

            if (CurrentActivePanelContainer == null)
            {
                return;
            }

            CGPoint touchPt;
            var     touch = touches.AnyObject as UITouch;

            if (touch != null)
            {
                touchPt = touch.LocationInView(View);
            }
            else
            {
                return;
            }

            CGRect newFrame = CurrentActivePanelContainer.Sliding(touchPt, SlidingController.View.Frame);

            SlidingController.View.Frame = newFrame;
        }