protected override void Dispose(bool disposing)
        {
            if (disposing && !_disposed)
            {
                Element.PropertyChanged -= HandlePropertyChanged;

                if (_tapGesture != null)
                {
                    if (_clickOffView != null && _clickOffView.GestureRecognizers.Contains(_panGesture))
                    {
                        ((IList)_clickOffView.GestureRecognizers).Remove(_tapGesture);
                        _clickOffView.Dispose();
                    }
                    _tapGesture.Dispose();
                }
                if (_panGesture != null)
                {
                    if (View != null && View.GestureRecognizers.Contains(_panGesture))
                    {
                        ((IList)View.GestureRecognizers).Remove(_panGesture);
                    }
                    _panGesture.Dispose();
                }

                EmptyContainers();

                _disposed = true;
            }

            base.Dispose(disposing);
        }
Esempio n. 2
0
        protected override void Dispose(bool disposing)
        {
            if (disposing && !_disposed)
            {
                Element.SizeChanged     -= PageOnSizeChanged;
                Element.PropertyChanged -= HandlePropertyChanged;

                if (_tapGesture != null)
                {
                    if (_clickOffView != null && _clickOffView.GestureRecognizers.Contains(_tapGesture))
                    {
                        _clickOffView.GestureRecognizers.Remove(_tapGesture);
                        _clickOffView.Dispose();
                    }
                    _tapGesture.Dispose();
                }
                if (_panGesture != null)
                {
                    if (View != null && View.GestureRecognizers.Contains(_panGesture))
                    {
                        View.GestureRecognizers.Remove(_panGesture);
                    }
                    _panGesture.Dispose();
                }

                EmptyContainers();

                Page.SendDisappearing();

                _disposed = true;
            }

            base.Dispose(disposing);
        }
        protected override void OnDetached()
        {
            if (effect?.Element == null)
            {
                return;
            }

            if (((View as IVisualNativeElementRenderer)?.Control ?? View) is UIButton button)
            {
                button.AllTouchEvents -= PreventButtonHighlight;
            }

            if (touchGesture != null)
            {
                View?.RemoveGestureRecognizer(touchGesture);
                touchGesture?.Dispose();
                touchGesture = null;
            }

            if (hoverGesture != null)
            {
                View?.RemoveGestureRecognizer(hoverGesture);
                hoverGesture?.Dispose();
                hoverGesture = null;
            }

            effect.Element = null;
            effect         = null;
        }
Esempio n. 4
0
        protected override void Dispose(bool disposing)
        {
            if (disposing && !_disposed)
            {
                _disposed = true;
                View?.RemoveGestureRecognizer(_tapGestureRecognizer);
                _tapGestureRecognizer?.Dispose();

                if (_willChangeFrameNotificationObserver != null)
                {
                    NSNotificationCenter.DefaultCenter.RemoveObserver(_willChangeFrameNotificationObserver);
                }

                if (_willHideNotificationObserver != null)
                {
                    NSNotificationCenter.DefaultCenter.RemoveObserver(_willHideNotificationObserver);
                }

                _willChangeFrameNotificationObserver?.Dispose();
                _willHideNotificationObserver?.Dispose();

                _willChangeFrameNotificationObserver = null;
                _willHideNotificationObserver        = null;
            }
            base.Dispose(disposing);
        }
Esempio n. 5
0
 protected override void OnDetached()
 {
     Container?.RemoveGestureRecognizer(_gesture);
     _gesture?.Dispose();
     _gesture        = null;
     _effect.Control = null;
     _effect         = null;
 }
        protected override void OnDetached()
        {
            if (effect?.Element == null)
            {
                return;
            }

            Container?.RemoveGestureRecognizer(gesture);
            gesture?.Dispose();
            gesture        = null;
            effect.Element = null;
            effect         = null;
        }
 protected override void Dispose(bool disposing)
 {
     if (disposing)
     {
         if (_swipeDown != null)
         {
             _swipeDown.Dispose();
             _swipeDown = null;
         }
         if (_swipeLeft != null)
         {
             _swipeLeft.Dispose();
             _swipeLeft = null;
         }
         if (_swipeRight != null)
         {
             _swipeRight.Dispose();
             _swipeRight = null;
         }
         if (_swipeUp != null)
         {
             _swipeUp.Dispose();
             _swipeUp = null;
         }
         if (_doubleTap != null)
         {
             _doubleTap.Dispose();
             _doubleTap = null;
         }
         if (_singleTap != null)
         {
             _singleTap.Dispose();
             _singleTap = null;
         }
         if (_pinch != null)
         {
             _pinch.Dispose();
             _pinch = null;
         }
     }
     // don't try and dispose the base - it will try and dispose of the native control that we didn't create
     //base.Dispose(disposing);
 }
Esempio n. 8
0
 public void DoubleDispose()
 {
     using (var gr = new UIGestureRecognizer()) {
         gr.Dispose();
     }
 }