bool CanScroll(UISwipeGestureRecognizerDirection scrollDirection)
        {
            if (scrollDirection == UISwipeGestureRecognizerDirection.Up && this.Frame.Location.Y < 0)
            {
                if (Math.Abs(this.Frame.Location.Y) >= Math.Abs(this.Frame.Size.Height - this.SuperviewFrame.Size.Height))
                {
                    if (this.TheDelegate != null)
                    {
                        this.TheDelegate.iOSCardsView_UpperLimitReached();
                    }

                    return(false);
                }
            }
            else if (scrollDirection == UISwipeGestureRecognizerDirection.Down && this.Frame.Location.Y > 0)
            {
                if (Math.Abs(this.Frame.Location.Y) >= this.ZeroFrame.Location.Y)
                {
                    if (this.TheDelegate != null)
                    {
                        this.TheDelegate.iOSCardsView_BottomLimitReached();
                    }

                    return(false);
                }
            }

            if ((this.Frame.Size.Height + this.Frame.Location.Y) < this.SuperviewFrame.Size.Height && (this.Frame.Location.Y >= this.ZeroFrame.Location.Y))
            {
                return(false);
            }

            return(true);
        }
		private Direction GetDirection(UISwipeGestureRecognizer gr)
		{
			UISwipeGestureRecognizerDirection direction = gr.Direction;
			if (direction <= UISwipeGestureRecognizerDirection.Up)
			{
				if (direction < UISwipeGestureRecognizerDirection.Right)
				{
					return Direction.NotClear;
				}
				switch ((int)(direction - UISwipeGestureRecognizerDirection.Right))
				{
				case 0:
					return Direction.Right;
				case 1:
					return Direction.Left;
				case 2:
					return Direction.NotClear;
				case 3:
					return Direction.Up;
				}
			}
			if (direction == UISwipeGestureRecognizerDirection.Down)
			{
				return Direction.Down;
			}
			return Direction.NotClear;
		}
        public static MvxSwipeGestureRecognizerBehaviour Swipe(this UIView view, UISwipeGestureRecognizerDirection direction,
                                                               uint numberOfTouchesRequired = 1)
        {
            var toReturn = new MvxSwipeGestureRecognizerBehaviour(view, direction, numberOfTouchesRequired);

            return(toReturn);
        }
 public static SwipeGestureRecognizerBehaviour Swipe(
     this UIView view,
     UISwipeGestureRecognizerDirection direction,
     uint numberOfTouchesRequired = 1)
 {
     return(new SwipeGestureRecognizerBehaviour(view, direction, numberOfTouchesRequired));
 }
        public MvxSwipeGestureRecognizerBehaviour(UIView target, UISwipeGestureRecognizerDirection direction,
                                                  uint numberOfTouchesRequired = 1)
        {
            var swipe = new UISwipeGestureRecognizer(HandleGesture)
            {
                Direction = direction,
            };

            AddGestureRecognizer(target, swipe);
        }
            public NativeSwipeGestureRecognizer(SwipeRecognizer recognizer, UISwipeGestureRecognizerDirection direction)
            {
                _recognizer = recognizer;

                CancelsTouchesInView    = false;
                Direction               = direction;
                NumberOfTouchesRequired = (nuint)recognizer.NumberOfTouchesRequired;
                ShouldReceiveTouch     += (UIGestureRecognizer r, UITouch touch) => touch.View == recognizer.View;

                AddTarget(() => recognizer.OnSwiped(direction.ToSwipeDirection()));
            }
        internal void UpdateCell(Task _newDataTasks, ViewController _viewController)
        {
            this._viewController = _viewController;

            Console.WriteLine("FOR INDEX : " + _newDataTasks.Id + "   Color Value is :" + _newDataTasks.Color);

            mainLabel.Text = _newDataTasks.Title;
            subLabel.Text  = _newDataTasks.Description;

            switch (_newDataTasks.Color)
            {
            case "R":
                ContentView.BackgroundColor = UIColor.Clear.FromHexString("#ff4e91", 1.0f);
                break;

            case "G":
                ContentView.BackgroundColor = UIColor.Clear.FromHexString("#59f859", 1.0f);
                break;

            case "B":
                ContentView.BackgroundColor = UIColor.Clear.FromHexString("#43D9FF", 1.0f);
                break;

            case "Y":
                ContentView.BackgroundColor = UIColor.Clear.FromHexString("#fff95c", 1.0f);
                break;

            case "W":
                ContentView.BackgroundColor = UIColor.Clear.FromHexString("#ffffff", 1.0f);
                break;
            }

            this._recognizer = new UILongPressGestureRecognizer();
            this._recognizer.MinimumPressDuration = 0.5f;
            this._recognizer.AddTarget(this, new ObjCRuntime.Selector("OnEditModeActivated"));
            this.AddGestureRecognizer(_recognizer);


            this._swipeRecognizer = new UISwipeGestureRecognizer();
            this._swipeRecognizer.AddTarget(this, new ObjCRuntime.Selector("OnDeleteModeActiavated"));
            this.AddGestureRecognizer(_swipeRecognizer);
            t_selected     = new Task();
            t_selected     = _newDataTasks;
            this._swipeDir = new UISwipeGestureRecognizerDirection();
        }
Exemple #8
0
        /// <summary>
        /// 取得滑動換頁指型事件
        /// </summary>
        /// <returns>The scroll view chang pan gesture.</returns>
        /// <param name="direction">Direction.</param>
        public UISwipeGestureRecognizer GetScrollViewChangPanGesture(UISwipeGestureRecognizerDirection direction)
        {
            return(new UISwipeGestureRecognizer((swipeDirection) =>
            {
                switch (direction)
                {
                case UISwipeGestureRecognizerDirection.Right:
                    PageNumber++;
                    break;

                case UISwipeGestureRecognizerDirection.Left:
                    PageNumber--;
                    break;
                }
                imageView.Image = GetPDFImageForPage();
                UIViewDataSaveHandle();
                scrollView.ScrollRectToVisible(new CGRect(0, 0, 100, 100), true);
            }));
        }
Exemple #9
0
        /// <summary>
        /// Convert to a <see cref="SwipeDirection"/>.
        /// </summary>
        /// <param name="direction">The <see cref="UISwipeGestureRecognizerDirection"/>.</param>
        /// <returns>The <see cref="SwipeDirection"/>.</returns>
        public static SwipeDirection ToSwipeDirection(this UISwipeGestureRecognizerDirection direction)
        {
            switch (direction)
            {
            case UISwipeGestureRecognizerDirection.Left:
                return(SwipeDirection.Left);

            case UISwipeGestureRecognizerDirection.Right:
                return(SwipeDirection.Right);

            case UISwipeGestureRecognizerDirection.Up:
                return(SwipeDirection.Up);

            case UISwipeGestureRecognizerDirection.Down:
                return(SwipeDirection.Down);

            default:
                throw new NotImplementedException();
            }
        }
        /*************************** Event Handlers ***************************/

        private void HandleSwipeGesture(UISwipeGestureRecognizerDirection direction)
        {
            switch (direction)
            {
            case UISwipeGestureRecognizerDirection.Right:
                if (jobTypeSegControl.SelectedSegment > 0)
                {
                    jobTypeSegControl.SelectedSegment -= 1;
                    JobTypeSegControl_ValueChanged(jobTypeSegControl);
                }
                break;

            case UISwipeGestureRecognizerDirection.Left:
                if (jobTypeSegControl.SelectedSegment < jobTypeSegControl.NumberOfSegments - 1)
                {
                    jobTypeSegControl.SelectedSegment += 1;
                    JobTypeSegControl_ValueChanged(jobTypeSegControl);
                }
                break;
            }
        }
 /// <summary>
 /// Creates each listener/recognizer with custom logic
 /// </summary>
 /// <param name="uISwipeGestureRecognizerDirection"></param>
 /// <param name="getCommand"></param>
 /// <returns></returns>
 private UISwipeGestureRecognizer TestCustom(UISwipeGestureRecognizerDirection uISwipeGestureRecognizerDirection, Func <Command <TestTry> > getCommand)
 {
     return(new UISwipeGestureRecognizer(() =>
     {
         var handler = getCommand();
         if (handler != null)
         {
             var control = Control ?? Container;
             var tapPoint = swipeDetectors[0].LocationInView(control);
             data.CustomField1 = uISwipeGestureRecognizerDirection.ToString();
             data.Coordinate.Clear();
             data.Coordinate.Add(new Point(tapPoint.X, tapPoint.Y));
             if (handler.CanExecute(data) == true)
             {
                 handler.Execute(data);
             }
         }
     })
     {
         Enabled = false,
         ShouldRecognizeSimultaneously = (recognizer, gestureRecognizer) => true,
         Direction = uISwipeGestureRecognizerDirection
     });
 }
        bool CanScroll(UISwipeGestureRecognizerDirection scrollDirection)
        {
            if (scrollDirection == UISwipeGestureRecognizerDirection.Up && this.Frame.Location.Y < 0)
            {
                if (Math.Abs(this.Frame.Location.Y) >= Math.Abs(this.Frame.Size.Height - this.SuperviewFrame.Size.Height))
                {
                    if (this.TheDelegate != null)
                    {
                        this.TheDelegate.iOSCardsView_UpperLimitReached();
                    }

                    return false;
                }

            }
            else if (scrollDirection == UISwipeGestureRecognizerDirection.Down && this.Frame.Location.Y > 0)
            {
                if (Math.Abs(this.Frame.Location.Y) >= this.ZeroFrame.Location.Y)
                {
                    if (this.TheDelegate != null)
                    {
                        this.TheDelegate.iOSCardsView_BottomLimitReached();
                    }

                    return false;
                }

            }

            if ((this.Frame.Size.Height + this.Frame.Location.Y) < this.SuperviewFrame.Size.Height && (this.Frame.Location.Y >= this.ZeroFrame.Location.Y))
            {
                return false;
            }

            return true;
        }
Exemple #13
0
 private UISwipeGestureRecognizer CreateSwipeRecognizer(Func <ICommand> getCommand, UISwipeGestureRecognizerDirection direction)
 {
     return(new UISwipeGestureRecognizer(() =>
     {
         var handler = getCommand();
         if (handler?.CanExecute(null) == true)
         {
             handler.Execute(null);
         }
     })
     {
         Enabled = false,
         ShouldRecognizeSimultaneously = (recognizer, gestureRecognizer) => true,
         Direction = direction
     });
 }
 public static MvxSwipeGestureRecognizerBehaviour Swipe(this UIView view, UISwipeGestureRecognizerDirection direction,
                                                        uint numberOfTouchesRequired = 1)
 {
     var toReturn = new MvxSwipeGestureRecognizerBehaviour(view, direction, numberOfTouchesRequired);
     return toReturn;
 }
Exemple #15
0
 public abstract void GestureControlDidSwipe(UISwipeGestureRecognizerDirection direction);