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; } }
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); }