Пример #1
0
        void Initialize()
        {
            _automationPropertiesProvider = new FastRenderers.AutomationPropertiesProvider(this);
            _backgroundTracker            = new BorderBackgroundManager(this);

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

            Tag = this;
        }
Пример #2
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 (Platform.GetRenderer(Element) == this)
                    {
                        Element.ClearValue(Platform.RendererProperty);
                    }
                }
            }

            base.Dispose(disposing);
        }