protected override void Dispose(bool disposing)
        {
            if (_isDisposed)
            {
                return;
            }

            _isDisposed = true;

            if (disposing)
            {
                if (Control.IsAlive())
                {
                    Control.SetOnClickListener(null);
                    Control.SetOnTouchListener(null);
                    Control.RemoveOnAttachStateChangeListener(this);
                }

                _backgroundTracker?.Dispose();
                _backgroundTracker     = null;
                _visualElementRenderer = null;
            }

            base.Dispose(disposing);
        }
Exemple #2
0
        void Initialize()
        {
            _automationPropertiesProvider = new AutomationPropertiesProvider(this);
            _backgroundTracker            = new BorderBackgroundManager(this);

            SoundEffectsEnabled   = false;
            OnFocusChangeListener = this;
            SetOnCheckedChangeListener(this);

            Tag = this;
        }
Exemple #3
0
        protected override void Dispose(bool disposing)
        {
            if (_isDisposed)
            {
                return;
            }

            _isDisposed = true;

            if (disposing)
            {
                _backgroundTracker?.Dispose();
                _backgroundTracker     = null;
                _visualElementRenderer = null;
            }

            base.Dispose(disposing);
        }
Exemple #4
0
        protected override void Dispose(bool disposing)
        {
            if (_isDisposed)
            {
                return;
            }

            _isDisposed = true;

            if (disposing)
            {
                SetOnClickListener(null);
                SetOnTouchListener(null);
                OnFocusChangeListener = null;
                SetOnCheckedChangeListener(null);

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

                _automationPropertiesProvider?.Dispose();
                _tracker?.Dispose();
                _visualElementRenderer?.Dispose();
                _backgroundTracker?.Dispose();
                _backgroundTracker = null;

                if (Element != null)
                {
                    if (AppCompat.Platform.GetRenderer(Element) == this)
                    {
                        Element.ClearValue(AppCompat.Platform.RendererProperty);
                    }
                }
            }

            base.Dispose(disposing);
        }
Exemple #5
0
 public ButtonRenderer()
 {
     AutoPackage            = false;
     _visualElementRenderer = this;
     _backgroundTracker     = new BorderBackgroundManager(this);