Exemplo n.º 1
0
        protected override void Dispose(bool disposing)
        {
            if (_disposed)
            {
                return;
            }

            _disposed = true;

            if (disposing)
            {
                if (Element != null)
                {
                    Element.PropertyChanged -= OnElementPropertyChanged;
                }

                Control.SetOnClickListener(null);
                Control.SetOnTouchListener(null);

                if (_gestureListener != null)
                {
                    _gestureListener.Dispose();
                    _gestureListener = null;
                }

                if (_renderer?.Element != null)
                {
                    UnsubscribeGestureRecognizers(Element);
                }

                _renderer = null;
            }

            base.Dispose(disposing);
        }
Exemplo n.º 2
0
        public GestureManager(IVisualElementRenderer renderer)
        {
            _renderer = renderer;
            _renderer.ElementChanged += OnElementChanged;

            _tapGestureHandler   = new TapGestureHandler(() => View);
            _panGestureHandler   = new PanGestureHandler(() => View, Control.Context.FromPixels);
            _pinchGestureHandler = new PinchGestureHandler(() => View);
            _gestureDetector     =
                new Lazy <GestureDetector>(
                    () =>
                    new GestureDetector(
                        _gestureListener =
                            new InnerGestureListener(_tapGestureHandler.OnTap, _tapGestureHandler.TapGestureRecognizers,
                                                     _panGestureHandler.OnPan, _panGestureHandler.OnPanStarted, _panGestureHandler.OnPanComplete)));

            _scaleDetector =
                new Lazy <ScaleGestureDetector>(
                    () =>
                    new ScaleGestureDetector(Control.Context,
                                             new InnerScaleListener(_pinchGestureHandler.OnPinch, _pinchGestureHandler.OnPinchStarted,
                                                                    _pinchGestureHandler.OnPinchEnded), Control.Handler));

            Control.SetOnClickListener(this);
            Control.SetOnTouchListener(this);
        }
Exemplo n.º 3
0
        protected override void Dispose(bool disposing)
        {
            if (disposing && !_disposed)
            {
                _disposed = true;

                if (_gestureListener != null)
                {
                    _gestureListener.Dispose();
                    _gestureListener = null;
                }

                if (_visualElementTracker != null)
                {
                    _visualElementTracker.Dispose();
                    _visualElementTracker = null;
                }

                if (_visualElementPackager != null)
                {
                    _visualElementPackager.Dispose();
                    _visualElementPackager = null;
                }

                if (Element != null)
                {
                    Element.PropertyChanged -= OnElementPropertyChanged;
                }
            }

            base.Dispose(disposing);
        }
Exemplo n.º 4
0
        public FrameRenderer() : base(Forms.Context)
        {
            _tapGestureHandler   = new TapGestureHandler(() => Element);
            _panGestureHandler   = new PanGestureHandler(() => Element, Context.FromPixels);
            _pinchGestureHandler = new PinchGestureHandler(() => Element);

            _gestureDetector =
                new Lazy <GestureDetector>(
                    () =>
                    new GestureDetector(
                        _gestureListener =
                            new InnerGestureListener(_tapGestureHandler.OnTap, _tapGestureHandler.TapGestureRecognizers, _panGestureHandler.OnPan, _panGestureHandler.OnPanStarted, _panGestureHandler.OnPanComplete)));

            _scaleDetector =
                new Lazy <ScaleGestureDetector>(
                    () => new ScaleGestureDetector(Context, new InnerScaleListener(_pinchGestureHandler.OnPinch, _pinchGestureHandler.OnPinchStarted, _pinchGestureHandler.OnPinchEnded), Handler));
        }
Exemplo n.º 5
0
		public FrameRenderer() : base(Forms.Context)
		{
			_tapGestureHandler = new TapGestureHandler(() => Element);
			_panGestureHandler = new PanGestureHandler(() => Element, Context.FromPixels);
			_pinchGestureHandler = new PinchGestureHandler(() => Element);

			_gestureDetector =
				new Lazy<GestureDetector>(
					() =>
					new GestureDetector(
						_gestureListener =
						new InnerGestureListener(_tapGestureHandler.OnTap, _tapGestureHandler.TapGestureRecognizers, _panGestureHandler.OnPan, _panGestureHandler.OnPanStarted, _panGestureHandler.OnPanComplete)));

			_scaleDetector =
				new Lazy<ScaleGestureDetector>(
					() => new ScaleGestureDetector(Context, new InnerScaleListener(_pinchGestureHandler.OnPinch, _pinchGestureHandler.OnPinchStarted, _pinchGestureHandler.OnPinchEnded), Handler));
		}
Exemplo n.º 6
0
        protected override void Dispose(bool disposing)
        {
            if (disposing && !_disposed)
            {
                _disposed = true;

                if (_gestureListener != null)
                {
                    _gestureListener.Dispose();
                    _gestureListener = null;
                }

                if (_visualElementTracker != null)
                {
                    _visualElementTracker.Dispose();
                    _visualElementTracker = null;
                }

                if (_visualElementPackager != null)
                {
                    _visualElementPackager.Dispose();
                    _visualElementPackager = null;
                }

                int count = ChildCount;
                for (var i = 0; i < count; i++)
                {
                    AView child = GetChildAt(i);
                    child.Dispose();
                }

                if (Element != null)
                {
                    Element.PropertyChanged -= OnElementPropertyChanged;
                    UnsubscribeGestureRecognizers(Element);
                }
            }

            base.Dispose(disposing);
        }
Exemplo n.º 7
0
		protected override void Dispose(bool disposing)
		{
			if (disposing && !_disposed)
			{
				_disposed = true;

				if (_gestureListener != null)
				{
					_gestureListener.Dispose();
					_gestureListener = null;
				}

				if (_visualElementTracker != null)
				{
					_visualElementTracker.Dispose();
					_visualElementTracker = null;
				}

				if (_visualElementPackager != null)
				{
					_visualElementPackager.Dispose();
					_visualElementPackager = null;
				}

				if (Element != null)
					Element.PropertyChanged -= OnElementPropertyChanged;
			}

			base.Dispose(disposing);
		}