Esempio n. 1
0
        public void SetShape(IVisualElementRenderer renderer, IBackgroundShape newShape)
        {
            _renderer = renderer;

            if (_shape != newShape)
            {
                if (_shape != null)
                {
                    _shape.ShapeInvalidateRequested -= OnShapeInvalidateRequested;
                }

                if (newShape != null)
                {
                    newShape.ShapeInvalidateRequested += OnShapeInvalidateRequested;
                }

                _shape = newShape;

                _pathProvider?.Dispose();
                _pathProvider = PathProvidersContainer.Resolve(_shape.GetType());

                if (_pathProvider != null)
                {
                    _pathProvider.SetShape(newShape);
                    _renderer?.NativeView?.FindLayerOfType <GradientStrokeLayer>()?.SetPathProvider(_pathProvider);
                }
            }

            Invalidate();
        }
        public void SetShape(AView view, IBackgroundShape newShape)
        {
            _nativeView = view;

            if (_shape != newShape)
            {
                if (_shape != null)
                {
                    _shape.ShapeInvalidateRequested -= OnShapeInvalidateRequested;
                }

                if (newShape != null)
                {
                    newShape.ShapeInvalidateRequested += OnShapeInvalidateRequested;
                }

                _shape = newShape;

                PathProvider?.Dispose();
                PathProvider = PathProvidersContainer.Resolve(_shape.GetType());

                if (PathProvider != null)
                {
                    PathProvider.SetShape(newShape);
                    _nativeView?.GetGradientDrawable()?.SetPathProvider(PathProvider);
                }
            }

            Invalidate();
        }
        protected virtual void Dispose(bool disposing)
        {
            if (_disposed || !disposing)
            {
                return;
            }

            _disposed = true;

            SetVisualElement(_visualElement, null);

            _defaultShape = null;
            if (_shapeManager != null)
            {
                _shapeManager.Dispose();
                _shapeManager = null;
            }

            if (_renderer != null)
            {
                _renderer.ElementChanged -= OnRendererElementChanged;
                _renderer = null;
            }

            if (_inkTouchController != null)
            {
                _inkTouchController.CancelInkTouchProcessing();
                _inkTouchController?.Dispose();
                _inkTouchController = null;
            }
        }
Esempio n. 4
0
        protected virtual void Dispose(bool disposing)
        {
            if (_disposed)
            {
                return;
            }

            _disposed = true;

            if (!disposing)
            {
                return;
            }

            _defaultShape = null;
            if (_shapeManager != null)
            {
                _shapeManager.Dispose();
                _shapeManager = null;
            }

            SetVisualElement(_visualElement, null);

            if (_renderer == null)
            {
                return;
            }
            _renderer.ElementChanged -= OnRendererElementChanged;

            _context    = null;
            _nativeView = null;
            _renderer   = null;
        }
        protected BasePathProvider()
        {
            _shape = new Rect();

            Path       = new Path();
            BorderPath = new Path();

            Invalidate();
        }
        public MaterialBackgroundManager(IVisualElementRenderer renderer)
        {
            _renderer = renderer ?? throw new ArgumentNullException(nameof(renderer), "Renderer cannot be null");
            _renderer.ElementChanged += OnRendererElementChanged;

            _defaultShape = new RoundRect();
            _shapeManager = new MaterialShapeManager();

            SetVisualElement(null, _renderer.Element);
        }
        public virtual void SetShape(IBackgroundShape shape)
        {
            if (_disposed)
            {
                return;
            }

            _shape = shape;

            Invalidate();
        }
        public virtual void Dispose(bool disposing)
        {
            if (_disposed)
            {
                return;
            }

            _disposed = true;

            _shape = null;

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

            if (BorderPath != null)
            {
                BorderPath.Dispose();
                BorderPath = null;
            }
        }
 public void SetShape(IBackgroundShape shape, bool overwrite = true)
 {
     _shapeManager?.SetShape(_renderer, overwrite ? shape : _defaultShape);
 }
Esempio n. 10
0
 public void SetShape(IBackgroundShape shape, bool overwrite = true)
 {
     _shapeManager?.SetShape(_nativeView, overwrite ? shape : _defaultShape);
 }
        public virtual void SetShape(IBackgroundShape shape)
        {
            _shape = shape;

            Invalidate();
        }
        protected BasePathProvider()
        {
            _shape = new Rect();

            Invalidate();
        }