protected override void OnElementChanged(ElementChangedEventArgs <View> e)
        {
            base.OnElementChanged(e);

            if (e.OldElement != null)
            {
                RemoveGestureRecognizer(panGesture);
                panGesture.RemoveTarget(panGestureToken);
            }
            if (e.NewElement != null)
            {
                var dragView = Element as DraggableView;
                panGesture      = new UIPanGestureRecognizer();
                panGestureToken = panGesture.AddTarget(DetectPan);
                AddGestureRecognizer(panGesture);


                dragView.RestorePositionCommand = new Command(() =>
                {
                    if (!firstTime)
                    {
                        Center = originalPosition;
                    }
                });
            }
        }
Exemple #2
0
    public override void ViewDidLoad()
    {
        base.ViewDidLoad();

        pauseLabel = new UILabel(CGRect.Empty)
        {
            Text          = "Paused",
            Font          = UIFont.BoldSystemFontOfSize(16),
            TextColor     = UIColor.White,
            TextAlignment = UITextAlignment.Center,
            TranslatesAutoresizingMaskIntoConstraints = true,
            Alpha = 0
        };

        accelerationView = new GradientView(CGRect.Empty)
        {
            TopColor    = Color.FromHex(0x64ff8f),
            BottomColor = Color.FromHex(0x51ffea)
        };

        View.AddSubview(pauseLabel);
        pauseLabel.CenterXAnchor.ConstraintEqualTo(View.CenterXAnchor).Active = true;
        pauseLabel.TopAnchor.ConstraintEqualTo(View.SafeAreaLayoutGuide.TopAnchor, 40);

        View.AddSubview(accelerationView);
        accelerationView.Center(View, new UIOffset(0, verticalOffset));
        accelerationView.WidthAnchor.ConstraintEqualTo(160).Active  = true;
        accelerationView.HeightAnchor.ConstraintEqualTo(160).Active = true;

        panRecognizer.AddTarget(Panned);
        accelerationView.AddGestureRecognizer(panRecognizer);
    }
        /// <summary>
        /// Initializes a new instance of the <see cref="SlideoutNavigationController"/> class.
        /// </summary>
        public SlideoutNavigationController()
        {
            SlideSpeed = 0.2f;
            SlideWidth = 260f;
            SlideHeight = 44f;
            LayerShadowing = true;

            _internalMenuView = new ProxyNavigationController
                                    {
                                        ParentController = this,
                                        View = { AutoresizingMask = UIViewAutoresizing.FlexibleHeight }
                                    };
            //_internalMenuView.SetNavigationBarHidden(true, false);

            _internalTopView = new UIViewController { View = { UserInteractionEnabled = true } };
            _internalTopView.View.Layer.MasksToBounds = false;

            _tapGesture = new UITapGestureRecognizer();
            //            _tapGesture.AddTarget(new )
            _tapGesture.AddTarget(Hide);
            _tapGesture.NumberOfTapsRequired = 1;

            _panGesture = new UIPanGestureRecognizer
                              {
                                  Delegate = new SlideoutPanDelegate(this),
                                  MaximumNumberOfTouches = 1,
                                  MinimumNumberOfTouches = 1
                              };
            _panGesture.AddTarget(() => Pan(_internalTopView.View));
            _internalTopView.View.AddGestureRecognizer(_panGesture);
        }
Exemple #4
0
        protected override void OnElementChanged(ElementChangedEventArgs <View> e)
        {
            base.OnElementChanged(e);

            if (e.OldElement != null)
            {
                RemoveGestureRecognizer(panGesture);
                panGesture.RemoveTarget(panGestureToken);
            }
            if (e.NewElement != null)
            {
                displayMetrics = UIScreen.MainScreen.Bounds;
                sH             = displayMetrics.Height;
                sW             = displayMetrics.Width;

                var dragView = Element as RadialMenu;
                panGesture      = new UIPanGestureRecognizer();
                panGestureToken = panGesture.AddTarget(DetectPan);
                AddGestureRecognizer(panGesture);


                dragView.RestorePositionCommand = new Command(() =>
                {
                    if (!firstTime)
                    {
                        Center = originalPosition;
                    }
                });
            }
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="SlideoutNavigationController"/> class.
        /// </summary>
        public SlideoutNavigationController()
        {
            SlideSpeed = 0.2f;
            SlideWidth = 245f;
            // HACK to detect pan gesture from the whole viewport
            SlideHeight = float.MaxValue;
            LayerShadowing = false;

            _internalMenuViewLeft = new ProxyNavigationController {
                ParentController = this,
                View = { AutoresizingMask = UIViewAutoresizing.FlexibleHeight }
            };
            _internalMenuViewRight = new ProxyNavigationController {
                ParentController = this,
                View = { AutoresizingMask = UIViewAutoresizing.FlexibleHeight }
            };

            _internalMenuViewLeft.SetNavigationBarHidden (DisplayNavigationBarOnLeftMenu, false);
            _internalMenuViewRight.SetNavigationBarHidden (DisplayNavigationBarOnRightMenu, false);

            _internalTopView = new UIViewController { View = { UserInteractionEnabled = true } };
            _internalTopView.View.Layer.MasksToBounds = false;

            _tapGesture = new UITapGestureRecognizer ();
            _tapGesture.AddTarget (() => Hide ());
            _tapGesture.NumberOfTapsRequired = 1;

            _panGesture = new UIPanGestureRecognizer {
                Delegate = new SlideoutPanDelegate(this),
                MaximumNumberOfTouches = 1,
                MinimumNumberOfTouches = 1
            };
            _panGesture.AddTarget (() => Pan (_internalTopView.View));
            _internalTopView.View.AddGestureRecognizer (_panGesture);
        }
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            this.View.UserInteractionEnabled = true;

            CustomUIExtensions.ViewShadowForChatPupUp(_backgroundView);

            _pictureImage.Image?.Dispose();

            if (!string.IsNullOrEmpty(_picture))
            {
                _pictureCopy = string.Copy(_picture);

                ImageService.Instance.LoadStream((token) => {
                    return(ImageHelper.GetStreamFromImageByte(token, _picture));
                }).ErrorPlaceholder("profile_noimage", ImageSource.CompiledResource).Retry(3, 200).Finish(CleanString).Transform(new CircleTransformation()).Into(_pictureImage);
            }
            else
            {
                _pictureImage.Image = UIImage.FromBundle("profile_noimage");
                CustomUIExtensions.RoundView(_pictureImage);
            }

            UILabelExtensions.SetupLabelAppearance(_nameLabel, _name, Colors.Black, 13f, UIFontWeight.Semibold);
            UILabelExtensions.SetupLabelAppearance(_descriptionLabel, _message, Colors.Black, 12f, UIFontWeight.Regular);

            _openChatButton.TouchUpInside -= OnOpenChatButton_TouchUpInside;
            _openChatButton.TouchUpInside += OnOpenChatButton_TouchUpInside;

            Xamarin.Essentials.Vibration.Vibrate(TimeSpan.FromMilliseconds(500));

            gesture.AddTarget(() => HandleDrag(gesture));
            this.View.AddGestureRecognizer(gesture);
        }
        protected override void OnElementChanged(ElementChangedEventArgs <View> e)
        {
            base.OnElementChanged(e);

            if (e.OldElement != null)
            {
                RemoveGestureRecognizer(panGesture);
                panGesture.RemoveTarget(panGestureToken);
            }
            if (e.NewElement != null)
            {
                var dragView = Element as DrawableAbsoluteLayout;
                panGesture      = new UIPanGestureRecognizer();
                panGestureToken = panGesture.AddTarget(DetectPan);
                AddGestureRecognizer(panGesture);

                tapGesture = new UITapGestureRecognizer();
                tapGesture.NumberOfTapsRequired = 2;
                tapGestureToken = tapGesture.AddTarget(DetectTapped);
                AddGestureRecognizer(tapGesture);

                dragView.RestorePositionCommand = new Command(() =>
                {
                    if (!firstTime)
                    {
                        Center = originalPosition;
                    }
                });
            }
        }
Exemple #8
0
        /// <summary>
        /// Replaces the content area view controller with the specified view controller.
        /// </summary>
        /// <param name="newContentView">
        /// New content view.
        /// </param>
        public void ChangeContentView(UIViewController newContentView)
        {
            if (_contentAreaView != null)
            {
                _contentAreaView.RemoveFromSuperview();
            }

            if (ContentAreaController != null)
            {
                ContentAreaController.RemoveFromParentViewController();
            }

            ContentAreaController = newContentView;
            SetVisibleView();
            CloseMenu();
            // setup a tap gesture to close the menu on root view tap
            _tapGesture = new UITapGestureRecognizer();
            _tapGesture.AddTarget(() => CloseMenu());
            _tapGesture.NumberOfTapsRequired = 1;
            _panGesture = new UIPanGestureRecognizer {
                Delegate = new SlideoutPanDelegate(),
                MaximumNumberOfTouches = 1,
                MinimumNumberOfTouches = 1
            };
            _panGesture.AddTarget(() => Pan(_contentAreaView));
            _contentAreaView.AddGestureRecognizer(_panGesture);
        }
Exemple #9
0
        void CreateGestureRecognizer()
        {
            UIPanGestureRecognizer swipeRecognizer = new UIPanGestureRecognizer();

            swipeRecognizer.AddTarget(() => HandleSwipe(swipeRecognizer));
            View.AddGestureRecognizer(swipeRecognizer);
        }
Exemple #10
0
        private void ConfigureView()
        {
            LoadingAnimation(true);

            _sendButton.Enabled = false;
            _textView.Delegate  = this;

            _tableView.SectionHeaderHeight = 0;
            _tableView.TableHeaderView     = new UIView(new CGRect(0, 0, 0, 0.1f));

            _keyboardViewBottomConstraint.Constant = _keyboardBottomHeight;
            _tableViewBottomConstraint.Constant    = _keyboardAreaView.Frame.Height + _keyboardBottomHeight;

            AddStatusInTableView();

            _tableViewTapGesture.AddTarget(HandleTableDragGesture);
            _tableViewSwipeGesture.AddTarget(HandleTableDragGesture);

            _tableScrollView = _tableView as UIScrollView;

            _tableView.SeparatorStyle  = UITableViewCellSeparatorStyle.None;
            _tableView.BackgroundColor = Colors.White;

            _imageView1.Image?.Dispose();
            _imageView2.Image?.Dispose();
            _imageView3.Image?.Dispose();

            _imageView1.Image = UIImage.FromBundle("keyboard");
            _imageView2.Image = UIImage.FromBundle("image_picker");
            _imageView3.Image = UIImage.FromBundle("files");

            _keyboardAreaView.BackgroundColor = Colors.KeyboardView;
            _fakeAreaView.BackgroundColor     = Colors.KeyboardView;

            _textView.EnablesReturnKeyAutomatically = true;
            _textView.TextContainerInset            = new UIEdgeInsets(10, 10, 10, 10);
            _textView.TextColor = Colors.Black;
            _textView.Font      = UIFont.SystemFontOfSize(14f);
            _textView.Text      = string.Empty;

            CustomUIExtensions.CornerView(_sendView, 2);
            UILabelExtensions.SetupLabelAppearance(_sendLabel, ViewModel.SendMessageButton, Colors.ProfileGray, 15f, UIFontWeight.Medium);
            UILabelExtensions.SetupLabelAppearance(_placeholderLabel, ViewModel.TypeSomething, Colors.ProfileGrayDarker, 14f);

            _sendView.BackgroundColor = UIColor.Clear;

            _button1.TouchUpInside -= OnButton1_TouchUpInside;
            _button1.TouchUpInside += OnButton1_TouchUpInside;

            _button2.TouchUpInside -= OnButton2_TouchUpInside;
            _button2.TouchUpInside += OnButton2_TouchUpInside;

            _button3.TouchUpInside -= OnButton3_TouchUpInside;
            _button3.TouchUpInside += OnButton3_TouchUpInside;

            _sendButton.TouchUpInside -= OnSendButton_TouchUpInside;
            _sendButton.TouchUpInside += OnSendButton_TouchUpInside;
        }
 protected void WireUpDragGestureRecognizer()
 {
     // create a new tap gesture
     UIPanGestureRecognizer gesture = new UIPanGestureRecognizer();
     // wire up the event handler (have to use a selector)
     gesture.AddTarget(() => HandleDrag(gesture));
     // add the gesture recognizer to the view
     imgDragMe.AddGestureRecognizer(gesture);
 }
Exemple #12
0
        /**
         * Adds a pan edge gesture to a view to present menus.
         *
         * - Parameter toView: The view to add a pan gesture to.
         *
         * - Returns: The pan gesture added to `toView`.
         */
        public UIPanGestureRecognizer AddPanGestureToPresent(UIView toView)
        {
            var panGestureRecognizer = new UIPanGestureRecognizer();

            panGestureRecognizer.AddTarget(/*SideMenuTransition.self, */ () => SideMenuTransition.HandlePresentMenuPan(panGestureRecognizer));
            toView.AddGestureRecognizer(panGestureRecognizer);

            return(panGestureRecognizer);
        }
        protected void WireUpDragGestureRecognizer()
        {
            // create a new tap gesture
            UIPanGestureRecognizer gesture = new UIPanGestureRecognizer();

            // wire up the event handler (have to use a selector)
            gesture.AddTarget(() => { HandleDrag(gesture); });
            // add the gesture recognizer to the view
            imgDragMe.AddGestureRecognizer(gesture);
        }
        protected void WireUpDragGestureRecognizer()
        {
            //---- create a new tap gesture
            UIPanGestureRecognizer gesture = new UIPanGestureRecognizer();

            //---- wire up the event handler (have to use a selector)
            gesture.AddTarget(this, new Selector("HandleDrag"));
            //---- add the gesture recognizer to the view
            this.imgDragMe.AddGestureRecognizer(gesture);
        }
Exemple #15
0
        private void WireUpDragGestureRecognizer()
        {
            // Create a new tap gesture
            UIPanGestureRecognizer gesture = new UIPanGestureRecognizer();

            // Wire up the event handler (have to use a selector)
            gesture.AddTarget(() => HandleDrag(gesture));  // to be defined
            // Add the gesture recognizer to the view
            View.AddGestureRecognizer(gesture);
        }
		private void WireUpDragGestureRecognizer()
		{
			// Create a new tap gesture
			UIPanGestureRecognizer gesture = new UIPanGestureRecognizer();

			// Wire up the event handler (have to use a selector)
			gesture.AddTarget(() => HandleDrag(gesture));

			// Add the gesture recognizer to the view
			DragImage.AddGestureRecognizer(gesture);
		}
Exemple #17
0
    public override void ViewDidLoad()
    {
        base.ViewDidLoad();

        View.AddSubview(rubberView);
        rubberView.Center(View);
        rubberView.WidthAnchor.ConstraintEqualTo(140).Active  = true;
        rubberView.HeightAnchor.ConstraintEqualTo(160).Active = true;

        panRecognizer.AddTarget(Panned);
        rubberView.AddGestureRecognizer(panRecognizer);
    }
Exemple #18
0
 private void SetupGestureRecognizers()
 {
     TapGesture = new UITapGestureRecognizer();
     TapGesture.AddTarget(() => CloseMenu());
     TapGesture.NumberOfTapsRequired = 1;
     PanGesture = new UIPanGestureRecognizer {
         Delegate = new SlideoutPanDelegate(),
         MaximumNumberOfTouches = 1,
         MinimumNumberOfTouches = 1
     };
     PanGesture.AddTarget(() => Pan());
 }
Exemple #19
0
        private UIPanGestureRecognizer SetupPanGestureRecognizer()
        {
            var panGestureRecongnizer = new UIPanGestureRecognizer
            {
                MaximumNumberOfTouches = 1,

                MinimumNumberOfTouches = 1
            };

            panGestureRecongnizer.AddTarget(() => HandlePan(panGestureRecongnizer));

            this.AddGestureRecognizer(panGestureRecongnizer);

            return(panGestureRecongnizer);
        }
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            IsOpen = true;

            var containerFrame = View.Bounds;

            containerFrame.X               = View.Bounds.Width;
            ContainerView.Frame            = containerFrame;
            ContainerView.BackgroundColor  = UIColor.White;
            ContainerView.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight;

            View.BackgroundColor = UIColor.White;

            _tapGesture = new UITapGestureRecognizer();
            _tapGesture.AddTarget(() => Close(true));
            _tapGesture.NumberOfTapsRequired = 1;

            _panGesture = new UIPanGestureRecognizer
            {
                Delegate = new PanDelegate(this),
                MaximumNumberOfTouches = 1,
                MinimumNumberOfTouches = 1
            };
            _panGesture.AddTarget(() => Pan(ContainerView));
            ContainerView.AddGestureRecognizer(_panGesture);

            if (_menuViewController != null)
            {
                SetMenuViewController(_menuViewController, false);
            }
            if (_mainViewController != null)
            {
                SetMainViewController(_mainViewController, false);
            }

            //Create some shadowing
            if (ShadowEnabled)
            {
                ContainerView.Layer.ShadowOffset = new CGSize(-5, 0);
                ContainerView.Layer.ShadowPath   = UIBezierPath.FromRect(ContainerView.Bounds).CGPath;
                ContainerView.Layer.ShadowRadius = 3.0f;
                ContainerView.Layer.ShadowColor  = UIColor.Black.CGColor;
            }
        }
        /// <summary>
        /// Initializes a new instance of the <see cref="SlideoutController"/> class.
        /// </summary>
        public SlideoutController(IntPtr handle)
            : base(handle)
        {
            this.NavigationControllerCreator = delegate(UIViewController view)
            {
                return(new UINavigationController(view));
            };
            SlideSpeed     = 0.2f;
            SlideWidth     = 245f;
            SlideHeight    = 44f;
            LayerShadowing = false;

            _internalMenuViewLeft = new ProxyNavigationController {
                ParentController = this,
                View             = { AutoresizingMask = UIViewAutoresizing.FlexibleHeight }
            };

            _internalMenuViewRight = new ProxyNavigationController {
                ParentController = this,
                View             = { AutoresizingMask = UIViewAutoresizing.FlexibleHeight }
            };

            _internalMenuViewLeft.SetNavigationBarHidden(DisplayNavigationBarOnLeftMenu, false);
            _internalMenuViewRight.SetNavigationBarHidden(DisplayNavigationBarOnRightMenu, false);

            _internalTopView = new UIViewController {
                View = { UserInteractionEnabled = true }
            };
            _internalTopView.View.Layer.MasksToBounds = false;

            _tapGesture = new UITapGestureRecognizer();
            _tapGesture.AddTarget(() => Hide());
            _tapGesture.NumberOfTapsRequired = 1;

            _panGesture = new UIPanGestureRecognizer {
                Delegate = new SlideoutPanDelegate(this),
                MaximumNumberOfTouches = 1,
                MinimumNumberOfTouches = 1
            };
            _panGesture.AddTarget(() => Pan(_internalTopView.View));
            _internalTopView.View.AddGestureRecognizer(_panGesture);
        }
        public MenuNavigationController()
        {
            IgnoreZones           = new List <UIView>();
            SlideSpeed            = 0.3f;
            SlideWidth            = 270f;
            SlideHeight           = UIScreen.MainScreen.ApplicationFrame.Height;
            FlyoutGestureEnable   = true;
            MenuSlidesWithTopView = false;

            _internalLeftMenuNavigationController = new UINavigationController
            {
                NavigationBarHidden = true
            };

            _internalRightMenuNavigationController = new UINavigationController
            {
                NavigationBarHidden = true
            };

            _internalTopNavigationController = new MenuTopNavigationController
            {
                View          = { Frame = new CGRect(0, 0, UIScreen.MainScreen.Bounds.Width, UIScreen.MainScreen.Bounds.Height), BackgroundColor = Theme.ColorPalette.Background.ToUIColor() },
                ToolbarHidden = true
            };

            _tapGesture = new UITapGestureRecognizer();
            _tapGesture.AddTarget(() => HideMenu());
            _tapGesture.NumberOfTapsRequired = 1;

            _panGesture = new UIPanGestureRecognizer
            {
                Delegate = new SlideoutPanDelegate(_internalTopNavigationController.View, this),
                MaximumNumberOfTouches = 1,
                MinimumNumberOfTouches = 1
            };

            _panGesture.AddTarget(() => Pan(_internalTopNavigationController.View));

            _internalTopNavigationController.View.AddGestureRecognizer(_panGesture);

            InitShadows();
        }
        private void AttachTouchEvents()
        {
            panGesture = new UIPanGestureRecognizer();

            tapGesture = new UITapGestureRecognizer();

            panGesture.AddTarget(() => {
                PanGestureMoveAround(panGesture);
            });

            tapGesture.AddTarget(() => {
                ExpandMenu(tapGesture);
            });


            tapGesture.NumberOfTapsRequired   = 1;
            panGesture.MaximumNumberOfTouches = 2;

            this.AddGestureRecognizer(panGesture);
            this.AddGestureRecognizer(tapGesture);
        }
Exemple #24
0
 public BarLineChartGesture()
 {
     tapGestureRecognizer   = new UITapGestureRecognizer();
     pinchGestureRecognizer = new UIPinchGestureRecognizer()
     {
         ShouldRecognizeSimultaneously = GestureRecognize
     };
     doubleTapGestureRecognizer = new UITapGestureRecognizer
     {
         NumberOfTapsRequired = 2
     };
     panGestureRecognizer = new UIPanGestureRecognizer()
     {
         ShouldRecognizeSimultaneously = GestureRecognize,
     };
     tapToken       = tapGestureRecognizer.AddTarget(HandleTap);
     pinchToken     = pinchGestureRecognizer.AddTarget(HandlePinch);
     doubleTapToken = doubleTapGestureRecognizer.AddTarget(HandleDoubleTap);
     panToken       = panGestureRecognizer.AddTarget(HandlePan);
     pinchEvent     = new PinchEvent();
     panEvent       = new PanEvent();
 }
        public void ApplyVirtualTopBar(UIView targetView)
        {
            if (_virtualTopBar != null && _virtualTopBarPanRecognizer != null)
            {
                _internalTopView.View.RemoveGestureRecognizer(_virtualTopBarPanRecognizer);
            }
            _virtualTopBar = null;
            _virtualTopBarPanRecognizer = null;

            if (targetView != null)
            {
                _virtualTopBarPanRecognizer = new UIPanGestureRecognizer {
                    Delegate = new SlideoutPanDelegate(this),
                    MaximumNumberOfTouches = 1,
                    MinimumNumberOfTouches = 1
                };
                _virtualTopBarPanRecognizer.AddTarget(() => PanVirtualTopBar(_internalTopView.View));

                targetView.AddGestureRecognizer(_virtualTopBarPanRecognizer);
                _virtualTopBar = targetView;
            }
        }
Exemple #26
0
        void SetupNavigationController(UISideMenuNavigationController forMenu, bool leftSide)
        {
            if (forMenu == null)
            {
                return;
            }

            var exitPanGesture = new UIPanGestureRecognizer();

            exitPanGesture.AddTarget(/*SideMenuTransition.self, */ () => SideMenuTransition.HandleHideMenuPan(exitPanGesture));
            forMenu.View.AddGestureRecognizer(exitPanGesture);
            forMenu.TransitioningDelegate  = SideMenuTransition.TransitioningDelegate;
            forMenu.ModalPresentationStyle = UIModalPresentationStyle.OverFullScreen;
            forMenu.LeftSide = leftSide;
            if (leftSide)
            {
                LeftSwipeToDismissGesture = exitPanGesture;
            }
            else
            {
                RightSwipeToDismissGesture = exitPanGesture;
            }
        }
Exemple #27
0
        // add and remove gestures  -----------------------------------------------------------------

        public void AddLeftGestures()
        {
            if (LeftViewController != null)
            {
                if (LeftPanGesture == null)
                {
                    LeftPanGesture = new UIPanGestureRecognizer();
                    LeftPanGesture.AddTarget(() => HandleLeftPanGesture(LeftPanGesture));
                    LeftPanGesture.ShouldReceiveTouch            += ShoudReceiveTouch;
                    LeftPanGesture.ShouldRecognizeSimultaneously += ShouldRecognizeSimultaneously;
                    View.AddGestureRecognizer(LeftPanGesture);
                }

                if (LeftTapGesture == null)
                {
                    LeftTapGesture = new UITapGestureRecognizer();
                    LeftTapGesture.AddTarget(() => ToggleLeft());
                    LeftTapGesture.ShouldReceiveTouch            += ShoudReceiveTouch;
                    LeftTapGesture.ShouldRecognizeSimultaneously += ShouldRecognizeSimultaneously;
                    View.AddGestureRecognizer(LeftTapGesture);
                }
            }
        }
Exemple #28
0
        public void AddRightGestures()
        {
            if (RightViewController != null)
            {
                if (RightPanGesture == null)
                {
                    RightPanGesture = new UIPanGestureRecognizer();
                    RightPanGesture.AddTarget(() => HandleRightPanGesture(RightPanGesture));
                    RightPanGesture.ShouldReceiveTouch            += ShoudReceiveTouch;
                    RightPanGesture.ShouldRecognizeSimultaneously += ShouldRecognizeSimultaneously;
                    View.AddGestureRecognizer(RightPanGesture);
                }

                if (RightTapGesture == null)
                {
                    RightTapGesture = new UITapGestureRecognizer();
                    RightTapGesture.AddTarget(() => ToggleRight());
                    RightTapGesture.ShouldReceiveTouch            += ShoudReceiveTouch;
                    RightTapGesture.ShouldRecognizeSimultaneously += ShouldRecognizeSimultaneously;
                    View.AddGestureRecognizer(RightTapGesture);
                }
            }
        }
Exemple #29
0
        private void WireUpDragGestureRecognizer()
        {
            // Create a new tap gesture
            UIPanGestureRecognizer gesture = new UIPanGestureRecognizer()
            {
                ShouldRecognizeSimultaneously = (a, b) => true,
                DelaysTouchesBegan            = false,
                DelaysTouchesEnded            = false,
                CancelsTouchesInView          = true
            };

            // Report touch
            Action action = () =>
            {
                HandleDrag(gesture);
            };

            // Wire up the event handler (have to use a selector)
            gesture.AddTarget(action);

            // Add the gesture recognizer to the view
            _img.AddGestureRecognizer(gesture);
        }
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            _viewSize = (float)UIScreen.MainScreen.Bounds.Width;
            _barView  = new UIView();
            _barView.BackgroundColor       = Colors.MainBlue;
            _separatorView.BackgroundColor = Colors.GrayDividerContacts;
            _separatorView.Hidden          = true;

            if (ViewModel.IsPresentingCustomView == ContactListViewModel.ContactsType.All)
            {
                this.Title = ViewModel.Title;

                if (UIDevice.CurrentDevice.CheckSystemVersion(11, 0))
                {
                    this.NavigationController.NavigationBar.PrefersLargeTitles = false;
                    this.NavigationItem.LargeTitleDisplayMode = UINavigationItemLargeTitleDisplayMode.Never;
                }

                this.NavigationItem.RightBarButtonItem = UIButtonExtensions.SetupImageBarButton(LocalConstants.TabBarIconSize, "contacts_filter", OpenFilter, false);

                _presentView.Hidden = true;
                _presentViewHeightConstraint.Constant = 0;
            }
            else
            {
                UILabelExtensions.SetupLabelAppearance(_titleLabel, ViewModel.IsPresentingCustomView == ContactListViewModel.ContactsType.Call ? ViewModel.NewCallTitle : ViewModel.NewChatTitle,
                                                       Colors.Black, 17f, UIFontWeight.Semibold);
                UIButtonExtensions.SetupButtonAppearance(_cancelButton, _cancelButton.TintColor, 17f, ViewModel.Cancel);

                _cancelButton.TitleLabel.Lines = 1;
                _cancelButton.TitleLabel.AdjustsFontSizeToFitWidth = true;
                _cancelButton.TitleLabel.LineBreakMode             = UILineBreakMode.Clip;
                _cancelButton.TouchUpInside -= OnCancelButton_TouchUpInside;
                _cancelButton.TouchUpInside += OnCancelButton_TouchUpInside;

                if (PhoneModelExtensions.IsIphoneX())
                {
                    _titleLabelHeightConstraint.Constant = _titleLabelHeightConstraint.Constant + 10;
                }
            }

            _pageViewController = new UIPageViewController(UIPageViewControllerTransitionStyle.Scroll, UIPageViewControllerNavigationOrientation.Horizontal);

            this.AddChildViewController(_pageViewController);
            _pageView.AddSubview(_pageViewController.View);

            _tableViewGesture.AddTarget(() => HandleDrag(_tableViewGesture));

            this.View.AddSubview(_barView);
            this.View.BringSubviewToFront(_barView);

            ConfigureView();

            _search = new UISearchController(searchResultsController: null)
            {
                DimsBackgroundDuringPresentation = false
            };
            _search.SearchBar.TintColor = Colors.White;
            _search.SearchBar.BarStyle  = UIBarStyle.Black;

            _textFieldInsideSearchBar = _search.SearchBar.ValueForKey(new NSString("searchField")) as UITextField;
            _textFieldInsideSearchBar.ReturnKeyType   = UIReturnKeyType.Done;
            _textFieldInsideSearchBar.ClearButtonMode = UITextFieldViewMode.Never;

            _search.SearchBar.OnEditingStarted -= OnSearchBar_OnEditingStarted;
            _search.SearchBar.OnEditingStarted += OnSearchBar_OnEditingStarted;

            _search.SearchBar.OnEditingStopped -= OnSearchBar_OnEditingStopped;
            _search.SearchBar.OnEditingStopped += OnSearchBar_OnEditingStopped;

            _search.SearchBar.CancelButtonClicked -= OnSearchBar_CancelButtonClicked;
            _search.SearchBar.CancelButtonClicked += OnSearchBar_CancelButtonClicked;

            _search.SearchResultsUpdater = this;

            if (UIDevice.CurrentDevice.CheckSystemVersion(11, 0))
            {
                _textFieldInsideSearchBar.Text = ViewModel.SearchLabel;
                _textFieldInsideSearchBar.Subviews[0].Alpha = 0.07f;

                _search.SearchBar.SetImageforSearchBarIcon(UIImage.FromBundle("search"), UISearchBarIcon.Search, UIControlState.Normal);
                _search.SearchBar.SetImageforSearchBarIcon(UIImage.FromBundle("clear"), UISearchBarIcon.Clear, UIControlState.Normal);

                this.DefinesPresentationContext      = true;
                this.NavigationItem.SearchController = _search;
            }
            else
            {
                this.DefinesPresentationContext = false;
                _search.HidesNavigationBarDuringPresentation = false;
                _search.SearchBar.BarStyle = UIBarStyle.Default;

                if (_tableViews?.Count > 0)
                {
                    _tableViews.FirstOrDefault().TableHeaderView = _search.SearchBar;
                }
            }

            ViewModel.PropertyChanged -= ViewModel_PropertyChanged;
            ViewModel.PropertyChanged += ViewModel_PropertyChanged;
        }
Exemple #31
0
        private void Initialize()
        {
            init = true;

            //y is relative to scrollview
            Frame = new CGRect(0, Y, C.X_MAX, 128);

            _tap = new UITapGestureRecognizer();
            _tap.NumberOfTapsRequired = 1;
            _tap.AddTarget(this, new Selector("TapGesture"));
            AddGestureRecognizer(_tap);

            _pan = new UIPanGestureRecognizer();
            _pan.MinimumNumberOfTouches = 1;
            _pan.CancelsTouchesInView   = false;
            _pan.AddTarget(this, new Selector("PanGesture"));
            //AddGestureRecognizer(_pan);

            UserInteractionEnabled = true;
            //Layer.BorderColor = UIColor.Green.CGColor;
            //Layer.BorderWidth = 3;

            //y is relative to this uiview now
            Y = 0;

            Title                        = new UITextView();
            Title.Frame                  = new CGRect(0, Y, C.X_MAX, 32);
            Title.Text                   = _title;
            Title.TextAlignment          = UITextAlignment.Center;
            Title.BackgroundColor        = UIColor.Clear;
            Title.TextColor              = UIColor.White;
            Title.Editable               = false;
            Title.UserInteractionEnabled = false;

            //Assignments = new SRButton(0, Y + 32, C.X_MAX, 64, new Selector("DeadFunc"));
            Assignments                        = new UITextView();
            Assignments.Frame                  = new CGRect(0, Y + 32, C.X_MAX, 64);
            Assignments.ScrollEnabled          = false;
            Assignments.BackgroundColor        = UIColor.Clear;
            Assignments.Editable               = false;
            Assignments.UserInteractionEnabled = false;

            //Assignments.View.TouchUpInside += (sender, e) =>
            //{
            //    PopAssignments();
            //};

            //Assignments.View.TouchUpOutside += (sender, e) =>
            //{
            //    UnPopAssignments();
            //};

            StringBuilder sb = new StringBuilder();

            for (int i = 0; i < _assignments.Length; i++)
            {
                sb.AppendLine(_assignments[i] + "__________" + _marks[i]);
            }
            Assignments.Text = sb.ToString();
            Assignments.Layer.BorderWidth = 1;
            Assignments.Layer.BorderColor = UIColor.White.CGColor;

            Percentages                        = new UITextView();
            Percentages.Frame                  = new CGRect(0, Y + 96, C.X_MAX, 32);
            Percentages.Text                   = room.Weights;
            Percentages.BackgroundColor        = UIColor.Clear;
            Percentages.TextAlignment          = UITextAlignment.Center;
            Percentages.Editable               = false;
            Percentages.UserInteractionEnabled = false;
        }
Exemple #32
0
            // animate a change from one viewcontroller to another
            public override void AnimateTransition(IUIViewControllerContextTransitioning transitionContext)
            {
                // get reference to our fromView, toView and the container view that we should perform the transition in
                var container           = transitionContext.ContainerView;
                var menuBackgroundColor = _sideMenuTransition.SideMenuManager.AnimationBackgroundColor;

                if (menuBackgroundColor != null)
                {
                    container.BackgroundColor = menuBackgroundColor;
                }

                // create a tuple of our screens
                var screens = new
                {
                    from = transitionContext.GetViewControllerForKey(UITransitionContext.FromViewControllerKey),
                    to   = transitionContext.GetViewControllerForKey(UITransitionContext.ToViewControllerKey)
                };

                // assign references to our menu view controller and the 'bottom' view controller from the tuple
                // remember that our menuViewController will alternate between the from and to view controller depending if we're presenting or dismissing
                var menuViewController = (!_sideMenuTransition.Presenting ? screens.from : screens.to);
                var topViewController  = !_sideMenuTransition.Presenting ? screens.to : screens.from;

                var menuView = menuViewController.View;
                var topView  = topViewController.View;

                // prepare menu items to slide in
                if (_sideMenuTransition.Presenting)
                {
                    var tapView = new UIView();
                    tapView.AutoresizingMask = UIViewAutoresizing.FlexibleHeight | UIViewAutoresizing.FlexibleWidth;
                    var exitPanGesture = new UIPanGestureRecognizer();
                    exitPanGesture.AddTarget(/*SideMenuTransition.Current, */ () => _sideMenuTransition.HandleHideMenuPan(exitPanGesture));
                    var exitTapGesture = new UITapGestureRecognizer();
                    exitTapGesture.AddTarget(/*SideMenuTransition.Current, */ () => _sideMenuTransition.HandleHideMenuTap(exitTapGesture));
                    tapView.AddGestureRecognizer(exitPanGesture);
                    tapView.AddGestureRecognizer(exitTapGesture);
                    _sideMenuTransition.TapView = tapView;

                    _sideMenuTransition.originalSuperview = topView.Superview;

                    // add the both views to our view controller
                    switch (_sideMenuTransition.SideMenuManager.PresentMode)
                    {
                    case SideMenuManager.MenuPresentMode.ViewSlideOut:
                        container.AddSubview(menuView);
                        container.AddSubview(topView);
                        topView.AddSubview(tapView);
                        break;

                    case SideMenuManager.MenuPresentMode.MenuSlideIn:
                    case SideMenuManager.MenuPresentMode.MenuDissolveIn:
                    case SideMenuManager.MenuPresentMode.ViewSlideInOut:
                        container.AddSubview(topView);
                        container.AddSubview(tapView);
                        container.AddSubview(menuView);
                        break;
                    }

                    if (_sideMenuTransition.SideMenuManager.FadeStatusBar)
                    {
                        var blackBar = new UIView();
                        var menuShrinkBackgroundColor = _sideMenuTransition.SideMenuManager.AnimationBackgroundColor;
                        if (menuShrinkBackgroundColor != null)
                        {
                            blackBar.BackgroundColor = menuShrinkBackgroundColor;
                        }
                        else
                        {
                            blackBar.BackgroundColor = UIColor.Black;
                        }
                        blackBar.UserInteractionEnabled = false;
                        container.AddSubview(blackBar);
                        _sideMenuTransition.StatusBarView = blackBar;
                    }

                    _sideMenuTransition.HideMenuStart(); // offstage for interactive
                }

                // perform the animation!
                var duration = TransitionDuration(transitionContext);
                var options  = _sideMenuTransition.interactive ? UIViewAnimationOptions.CurveLinear : UIViewAnimationOptions.CurveEaseInOut;

                UIView.Animate(duration, 0, options,
                               animation: () =>
                {
                    if (_sideMenuTransition.Presenting)
                    {
                        _sideMenuTransition.PresentMenuStart();     // onstage items: slide in
                    }
                    else
                    {
                        _sideMenuTransition.HideMenuStart();
                    }
                    menuView.UserInteractionEnabled = false;
                },
                               completion: () =>
                {
                    // tell our transitionContext object that we've finished animating
                    if (transitionContext.TransitionWasCancelled)
                    {
                        var viewControllerForPresentedMenu = _sideMenuTransition.viewControllerForPresentedMenu;

                        if (_sideMenuTransition.Presenting)
                        {
                            _sideMenuTransition.HideMenuComplete();
                        }
                        else
                        {
                            _sideMenuTransition.presentMenuComplete();
                        }
                        menuView.UserInteractionEnabled = true;

                        transitionContext.CompleteTransition(false);


                        if (_sideMenuTransition.switchMenus)
                        {
                            _sideMenuTransition.switchMenus = false;
                            viewControllerForPresentedMenu?.PresentViewController(
                                _sideMenuTransition.SideMenuManager.LeftNavigationController,
                                true, null);
                        }

                        return;
                    }

                    if (_sideMenuTransition.Presenting)
                    {
                        _sideMenuTransition.presentMenuComplete();
                        menuView.UserInteractionEnabled = true;
                        transitionContext.CompleteTransition(true);
                        switch (_sideMenuTransition.SideMenuManager.PresentMode)
                        {
                        case SideMenuManager.MenuPresentMode.ViewSlideOut:
                            container.AddSubview(topView);
                            break;

                        case SideMenuManager.MenuPresentMode.MenuSlideIn:
                        case SideMenuManager.MenuPresentMode.MenuDissolveIn:
                        case SideMenuManager.MenuPresentMode.ViewSlideInOut:
                            container.InsertSubview(topView, atIndex: 0);
                            break;
                        }

                        var statusBarView = _sideMenuTransition.StatusBarView;
                        if (statusBarView != null)
                        {
                            container.BringSubviewToFront(statusBarView);
                        }
                        return;
                    }

                    _sideMenuTransition.HideMenuComplete();
                    transitionContext.CompleteTransition(true);
                    menuView.RemoveFromSuperview();
                });
            }
 public SlideTransitionInteractionController(UIPanGestureRecognizer gesture)
 {
     gestureRecognizer = gesture;
     gestureRecognizer.AddTarget(() => GestureRecognizeDidUpdate(gestureRecognizer));
 }
		private void SetupGestureRecognizers() {
			TapGesture = new UITapGestureRecognizer ();
			TapGesture.AddTarget (() => CloseMenu());
			TapGesture.NumberOfTapsRequired = 1;
			PanGesture = new UIPanGestureRecognizer {
				Delegate = new SlideoutPanDelegate(),
				MaximumNumberOfTouches = 1,
				MinimumNumberOfTouches = 1
			};
			PanGesture.AddTarget(() => Pan());
		}
		private void AttachTouchEvents ()
		{

			panGesture = new UIPanGestureRecognizer ();

			panGesture.AddTarget (() => { 				
				PanGestureMoveAround (panGesture);
			});
			panGesture.MaximumNumberOfTouches = 2;
			this.AddGestureRecognizer (panGesture);
		}
        private void InitializeImpl()
        {
            if (DesignTime.IsDesignMode)
            {
                // Add placeholder for design-time
                // Set background to light gray
                Layer.BackgroundColor = UIColor.FromRGBA(230, 230, 230, 255).CGColor;

                // Add "Time Slider" label
                var label = new UILabel()
                {
                    Text = "Time Slider",
                    Font = UIFont.SystemFontOfSize(11),
                    TranslatesAutoresizingMaskIntoConstraints = false,
                };
                AddSubview(label);

                // Center the "Time Slider" label
                label.CenterXAnchor.ConstraintEqualTo(CenterXAnchor).Active = true;
                label.CenterYAnchor.ConstraintEqualTo(CenterYAnchor).Active = true;
                return;
            }

            var fullExtentLabelFormat = string.IsNullOrEmpty(FullExtentLabelFormat) ? _defaultFullExtentLabelFormat : FullExtentLabelFormat;

            FullExtentStartTimeLabel = new UILabel()
            {
                Text      = FullExtent?.StartTime.ToString(fullExtentLabelFormat) ?? string.Empty,
                Font      = UIFont.SystemFontOfSize(11),
                TextColor = FullExtentLabelColor,
            };
            AddSubview(FullExtentStartTimeLabel);

            FullExtentEndTimeLabel = new UILabel()
            {
                Text      = FullExtent?.EndTime.ToString(fullExtentLabelFormat) ?? string.Empty,
                Font      = UIFont.SystemFontOfSize(11),
                TextColor = FullExtentLabelColor,
            };
            AddSubview(FullExtentEndTimeLabel);

            PreviousButton = new DrawActionButton()
            {
                BackgroundColor   = PlaybackButtonsFill,
                BorderColor       = PlaybackButtonsStroke,
                BorderWidth       = 0.5,
                DrawContentAction = (context, button) =>
                {
                    var spacing        = 3 + button.BorderWidth;
                    var barWidth       = 3;
                    var triangleWidth  = button.Bounds.Width - spacing - barWidth;
                    var triangleHeight = button.Bounds.Height - (button.BorderWidth * 2);
                    DrawTriangle(context, triangleWidth, triangleHeight, button.BackgroundColor.CGColor, button.BorderWidth,
                                 button.BorderColor.CGColor, pointOnRight: false, left: 0, top: button.BorderWidth);

                    var barLeft = triangleWidth + spacing - button.BorderWidth;
                    DrawRectangle(context, barWidth, button.Bounds.Height, button.BackgroundColor.CGColor,
                                  button.BorderWidth, button.BorderColor.CGColor, left: barLeft);
                },
            };
            PreviousButton.TouchUpInside += (o, e) => OnPreviousButtonClick();
            AddSubview(PreviousButton);

            NextButton = new DrawActionButton()
            {
                BackgroundColor   = PlaybackButtonsFill,
                BorderColor       = PlaybackButtonsStroke,
                BorderWidth       = 0.5,
                DrawContentAction = (context, button) =>
                {
                    var spacing        = 3 + button.BorderWidth;
                    var barWidth       = 3;
                    var triangleWidth  = button.Bounds.Width - spacing - barWidth;
                    var triangleHeight = button.Bounds.Height - (button.BorderWidth * 2);
                    DrawRectangle(context, barWidth, button.Bounds.Height, button.BackgroundColor.CGColor,
                                  button.BorderWidth, button.BorderColor.CGColor, left: button.BorderWidth);

                    DrawTriangle(context, triangleWidth, triangleHeight, button.BackgroundColor.CGColor, button.BorderWidth,
                                 button.BorderColor.CGColor, pointOnRight: true, left: barWidth + spacing, top: button.BorderWidth);
                },
            };
            NextButton.TouchUpInside += (o, e) => OnNextButtonClick();
            AddSubview(NextButton);

            PlayPauseButton = new DrawActionToggleButton()
            {
                BackgroundColor          = PlaybackButtonsFill,
                BorderColor              = PlaybackButtonsStroke,
                BorderWidth              = 0.5,
                DrawCheckedContentAction = (context, button) =>
                {
                    var spacing  = 4d;
                    var barWidth = 7d;
                    var left     = button.Bounds.GetMidX() - (spacing / 2) - barWidth - 2;
                    DrawRectangle(context, barWidth, button.Bounds.Height, button.BackgroundColor.CGColor, button.BorderWidth, button.BorderColor.CGColor, left);

                    left = button.Bounds.GetMidX() + (spacing / 2);
                    DrawRectangle(context, barWidth, button.Bounds.Height, button.BackgroundColor.CGColor, button.BorderWidth, button.BorderColor.CGColor, left);
                },
                DrawUncheckedContentAction = (context, button) =>
                {
                    var triangleWidth = button.Bounds.Width - button.BorderWidth;
                    DrawTriangle(context, triangleWidth, button.Bounds.Height, button.BackgroundColor.CGColor, button.BorderWidth,
                                 button.BorderColor.CGColor, pointOnRight: true, left: button.BorderWidth);
                },
            };
            PlayPauseButton.CheckedChanged += (o, e) => IsPlaying = PlayPauseButton.IsChecked;
            AddSubview(PlayPauseButton);

            var endTickWidth  = 1;
            var endTickHeight = 10;

            _startTimeTickmark = new RectangleView(endTickWidth, endTickHeight)
            {
                BackgroundColor = FullExtentStroke,
            };
            AddSubview(_startTimeTickmark);

            _endTimeTickmark = new RectangleView(endTickWidth, endTickHeight)
            {
                BackgroundColor = FullExtentStroke
            };
            AddSubview(_endTimeTickmark);

            var sliderTrackHeight = 2;

            SliderTrack = new RectangleView(100, sliderTrackHeight)
            {
                BackgroundColor = FullExtentFill,
                BorderColor     = FullExtentStroke,
                BorderWidth     = FullExtentBorderWidth,
            };
            AddSubview(SliderTrack);

            HorizontalTrackThumb = new RectangleView(100, sliderTrackHeight)
            {
                BackgroundColor = CurrentExtentFill,
                BorderColor     = FullExtentStroke,
                BorderWidth     = SliderTrack.BorderWidth,
            };
            HorizontalTrackThumb.PropertyChanged += (o, e) =>
            {
                if (e.PropertyName == nameof(RectangleView.Frame))
                {
                    HorizontalTrackThumb.Width = HorizontalTrackThumb.Frame.Width;
                }
            };

            SliderTrack.AddSubview(HorizontalTrackThumb);

            Tickmarks = new Primitives.Tickbar()
            {
                TickFill       = TimeStepIntervalTickFill,
                TickLabelColor = TimeStepIntervalLabelColor,
                ShowTickLabels = LabelMode == TimeSliderLabelMode.TimeStepInterval,
            };
            SliderTrack.AddSubview(Tickmarks);

            var thumbSize    = 36;
            var disabledSize = new CGSize(7, 16);

            MinimumThumb = new Thumb()
            {
                Width        = thumbSize,
                Height       = thumbSize,
                DisabledSize = disabledSize,
                CornerRadius = thumbSize / 2d,
                UseShadow    = true,
                Enabled      = !IsStartTimePinned,
            };
            SliderTrack.AddSubview(MinimumThumb);

            MaximumThumb = new Thumb()
            {
                Width        = thumbSize,
                Height       = thumbSize,
                DisabledSize = disabledSize,
                CornerRadius = thumbSize / 2d,
                UseShadow    = true,
                Enabled      = !IsEndTimePinned,
            };
            SliderTrack.AddSubview(MaximumThumb);

            var currentExtentLabelFormat = string.IsNullOrEmpty(CurrentExtentLabelFormat) ?
                                           _defaultCurrentExtentLabelFormat : CurrentExtentLabelFormat;

            MinimumThumbLabel = new UILabel()
            {
                Text          = CurrentExtent?.StartTime.ToString(currentExtentLabelFormat) ?? string.Empty,
                Font          = UIFont.SystemFontOfSize(11),
                TextColor     = CurrentExtentLabelColor,
                Hidden        = LabelMode != TimeSliderLabelMode.CurrentExtent,
                LineBreakMode = UILineBreakMode.Clip,
            };
            SliderTrack.AddSubview(MinimumThumbLabel);

            MaximumThumbLabel = new UILabel()
            {
                Text          = CurrentExtent?.StartTime.ToString(currentExtentLabelFormat) ?? string.Empty,
                Font          = UIFont.SystemFontOfSize(11),
                TextColor     = CurrentExtentLabelColor,
                Hidden        = LabelMode != TimeSliderLabelMode.CurrentExtent,
                LineBreakMode = UILineBreakMode.Clip,
            };
            SliderTrack.AddSubview(MaximumThumbLabel);

            // Add pan gesture recognizer to handle thumb manipulation
            var panRecognizer = new UIPanGestureRecognizer()
            {
                CancelsTouchesInView = false
            };

            panRecognizer.AddTarget(() =>
            {
                switch (panRecognizer.State)
                {
                case UIGestureRecognizerState.Began:
                    // Check whether gesture started on one of the thumbs.
                    // Use a minimum target size of 44 x 44 for hit testing.
                    var minTargetSize        = 44;
                    var minThumbHitTestFrame = ExpandFrame(MinimumThumb.Frame, minTargetSize);
                    var maxThumbHitTestFrame = ExpandFrame(MaximumThumb.Frame, minTargetSize);
                    var location             = panRecognizer.LocationInView(SliderTrack);

                    // Check if gesture is within min thumb
                    if (!IsStartTimePinned && minThumbHitTestFrame.Contains(location))
                    {
                        MinimumThumb.IsFocused = true;
                        _lastTouchLocation     = panRecognizer.LocationInView(MinimumThumb);
                    }

                    // Check if gesture is within max thumb
                    if (!IsEndTimePinned && maxThumbHitTestFrame.Contains(location))
                    {
                        MaximumThumb.IsFocused = true;
                        _lastTouchLocation     = panRecognizer.LocationInView(MaximumThumb);
                    }

                    // TODO: Allow dragging middle thumb?
                    // else if (HorizontalTrackThumb.Frame.Contains(location))
                    // {
                    //   _isHorizontalThumbFocused = true;
                    //   _lastTouchLocation = panRecognizer.LocationInView(HorizontalTrackThumb);
                    // }
                    break;

                case UIGestureRecognizerState.Changed:
                    if (!MinimumThumb.IsFocused && !MaximumThumb.IsFocused && !(MinimumThumb.IsFocused && IsStartTimePinned) && !(MaximumThumb.IsFocused && IsEndTimePinned))
                    {
                        return;
                    }

                    UIView trackedView = null;
                    if (MinimumThumb.IsFocused && MaximumThumb.IsFocused)
                    {
                        // Gesture was within both min and max thumb, so let the direction of the gesture determine which thumb should be dragged
                        var maxThumbTranslateX = panRecognizer.LocationInView(MaximumThumb).X - _lastTouchLocation.X;
                        if (maxThumbTranslateX < 0)
                        {
                            // Gesture is moving thumb toward the min, so put focus on min thumb
                            trackedView            = MinimumThumb;
                            MaximumThumb.IsFocused = false;
                        }
                        else
                        {
                            // Gesture is moving thumb toward the max, so put focus on min thumb
                            trackedView            = MaximumThumb;
                            MinimumThumb.IsFocused = false;
                        }
                    }
                    else if (MinimumThumb.IsFocused)
                    {
                        trackedView = MinimumThumb;
                    }
                    else if (MaximumThumb.IsFocused)
                    {
                        trackedView = MaximumThumb;
                    }

                    var currentLocation = panRecognizer.LocationInView(trackedView);
                    var translateX      = currentLocation.X - _lastTouchLocation.X;

                    if (MinimumThumb.IsFocused)
                    {
                        OnMinimumThumbDrag(translateX);
                    }

                    if (MaximumThumb.IsFocused)
                    {
                        OnMaximumThumbDrag(translateX);
                    }

                    // TODO: Allow dragging middle thumb?
                    // if (_isHorizontalThumbFocused)
                    // OnCurrentExtentThumbDrag(translateX);
                    break;

                case UIGestureRecognizerState.Ended:
                case UIGestureRecognizerState.Cancelled:
                case UIGestureRecognizerState.Failed:
                    MinimumThumb.IsFocused = false;
                    MaximumThumb.IsFocused = false;
                    OnDragCompleted();
                    break;
                }
            });
            AddGestureRecognizer(panRecognizer);

            PositionTickmarks();
            ApplyLabelMode(LabelMode);
        }
		private static void Register(View view, UIView uiview)
		{
			foreach (var elementsGestureRecognizer in view.GestureRecognizers)
			{
				TypeSwitch.Do(elementsGestureRecognizer,

					TypeSwitch.Case<XF.GestureRecognizers.TapGestureRecognizer>(gestureRecognizer =>
						{
							var platformGestureRecognizer = new UITapGestureRecognizer
							{
								NumberOfTapsRequired = gestureRecognizer.NumberOfTaps,
								NumberOfTouchesRequired = gestureRecognizer.NumberOfTouches,
								ShouldRecognizeSimultaneously = (a, b) => true
							};
							var eventArgs = new iOS_TapGestureEventArgs(gestureRecognizer, platformGestureRecognizer);

							platformGestureRecognizer.AddTarget(() =>
								{
									if (gestureRecognizer.Command != null && gestureRecognizer.Command.CanExecute(gestureRecognizer.CommandParameter))
									{
										gestureRecognizer.Command.Execute(eventArgs);
									}
								});

							uiview.AddGestureRecognizer(platformGestureRecognizer);
						}),

					TypeSwitch.Case<LongPressGestureRecognizer>(gestureRecognizer =>
						{
							var platformGestureRecognizer = new UILongPressGestureRecognizer
							{
								NumberOfTapsRequired = gestureRecognizer.NumberOfTaps,
								NumberOfTouchesRequired = gestureRecognizer.NumberOfTouches,
								MinimumPressDuration = gestureRecognizer.MinimumDuration,
								ShouldRecognizeSimultaneously = (a, b) => true
							};
							var eventArgs = new iOS_LongPressGestureEventArgs(gestureRecognizer, platformGestureRecognizer);

							platformGestureRecognizer.AddTarget(() =>
								{
									if (gestureRecognizer.Command != null && gestureRecognizer.Command.CanExecute(gestureRecognizer.CommandParameter))
									{
										gestureRecognizer.Command.Execute(eventArgs);
									}
								});

							uiview.AddGestureRecognizer(platformGestureRecognizer);
						}),

					TypeSwitch.Case<PanGestureRecognizer>(gestureRecognizer =>
						{
							var platformGestureRecognizer = new UIPanGestureRecognizer
							{
								MaximumNumberOfTouches = gestureRecognizer.MaximumNumberOfTouches,
								MinimumNumberOfTouches = gestureRecognizer.MinimumNumberOfTouches,
								ShouldRecognizeSimultaneously = (a, b) => true
							};
							var eventArgs = new iOS_PanGestureEventArgs(gestureRecognizer, platformGestureRecognizer);

							platformGestureRecognizer.AddTarget(() =>
								{
									if (gestureRecognizer.Command != null && gestureRecognizer.Command.CanExecute(gestureRecognizer.CommandParameter))
									{
										gestureRecognizer.Command.Execute(eventArgs);
									}
								});

							uiview.AddGestureRecognizer(platformGestureRecognizer);
						}),

					TypeSwitch.Case<XF.GestureRecognizers.PinchGestureRecognizer>(gestureRecognizer =>
						{
							var platformGestureRecognizer = new UIPinchGestureRecognizer
							{
								ShouldRecognizeSimultaneously = (a, b) => true
							};
							var eventArgs = new iOS_PinchGestureEventArgs(gestureRecognizer, platformGestureRecognizer);

							platformGestureRecognizer.AddTarget(() =>
								{
									if (gestureRecognizer.Command != null && gestureRecognizer.Command.CanExecute(gestureRecognizer.CommandParameter))
									{
										gestureRecognizer.Command.Execute(eventArgs);
									}
								});

							uiview.AddGestureRecognizer(platformGestureRecognizer);
						}),

					TypeSwitch.Case<SwipeGestureRecognizer>(gestureRecognizer =>
						{
							var platformGestureRecognizer = new UISwipeGestureRecognizer
							{
								Direction = (UISwipeGestureRecognizerDirection)gestureRecognizer.Direction,
								ShouldRecognizeSimultaneously = (a, b) => true
							};
							var eventArgs = new iOS_SwipeGestureEventArgs(gestureRecognizer, platformGestureRecognizer);

							platformGestureRecognizer.AddTarget(() =>
								{
									if (gestureRecognizer.Command != null && gestureRecognizer.Command.CanExecute(gestureRecognizer.CommandParameter))
									{
										gestureRecognizer.Command.Execute(eventArgs);
									}
								});

							uiview.AddGestureRecognizer(platformGestureRecognizer);
						}),

					TypeSwitch.Case<RotationGestureRecognizer>(gestureRecognizer =>
						{
							var platformGestureRecognizer = new UIRotationGestureRecognizer
							{
								ShouldRecognizeSimultaneously = (a, b) => true
							};
							var eventArgs = new iOS_RotateGestureEventArgs(gestureRecognizer, platformGestureRecognizer);

							platformGestureRecognizer.AddTarget(() =>
								{
									if (gestureRecognizer.Command != null && gestureRecognizer.Command.CanExecute(gestureRecognizer.CommandParameter))
									{
										gestureRecognizer.Command.Execute(eventArgs);
									}
								});

							uiview.AddGestureRecognizer(platformGestureRecognizer);
						})
				);
			}
		}
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            IsOpen = true;

            var containerFrame = View.Bounds;
            containerFrame.X = View.Bounds.Width;
            ContainerView.Frame = containerFrame;
            ContainerView.BackgroundColor = UIColor.White;
            ContainerView.AutoresizingMask = UIViewAutoresizing.FlexibleWidth | UIViewAutoresizing.FlexibleHeight;

            View.BackgroundColor = UIColor.White;

            _tapGesture = new UITapGestureRecognizer();
            _tapGesture.AddTarget (() => Close(true));
            _tapGesture.NumberOfTapsRequired = 1;

            _panGesture = new UIPanGestureRecognizer {
                Delegate = new PanDelegate(this),
                MaximumNumberOfTouches = 1,
                MinimumNumberOfTouches = 1
            };
            _panGesture.AddTarget (() => Pan (ContainerView));
            ContainerView.AddGestureRecognizer(_panGesture);

            if (_menuViewController != null)
                SetMenuViewController(_menuViewController, false);
            if (_mainViewController != null)
                SetMainViewController(_mainViewController, false);

            //Create some shadowing
            if (ShadowEnabled)
            {
                ContainerView.Layer.ShadowOffset = new SizeF(-5, 0);
                ContainerView.Layer.ShadowPath = UIBezierPath.FromRect(ContainerView.Bounds).CGPath;
                ContainerView.Layer.ShadowRadius = 3.0f;
                ContainerView.Layer.ShadowColor = UIColor.Black.CGColor;
            }
        }
 /// <summary>
 /// Replaces the content area view controller with the specified view controller.
 /// </summary>
 /// <param name="newContentView">
 /// New content view.
 /// </param>
 public void ChangeContentView(UIViewController newContentView)
 {
     if (_contentAreaView != null)
         _contentAreaView.RemoveFromSuperview();
     ContentAreaController = newContentView;
     CloseMenu(true);
     SetVisibleView();
     // setup a tap gesture to close the menu on root view tap
     _tapGesture = new UITapGestureRecognizer ();
     _tapGesture.AddTarget (() => CloseMenu());
     _tapGesture.NumberOfTapsRequired = 1;
     _panGesture = new UIPanGestureRecognizer {
         Delegate = new SlideoutPanDelegate(this),
         MaximumNumberOfTouches = 1,
         MinimumNumberOfTouches = 1
     };
     _panGesture.AddTarget (() => Pan (_contentAreaView));
     _contentAreaView.AddGestureRecognizer(_panGesture);
 }