Ejemplo n.º 1
0
        void DisposeChildRenderers()
        {
            IVisualElementRenderer childRenderer = Platform.GetRenderer(_childView);

            childRenderer?.Dispose();
            _childView?.ClearValue(Platform.RendererProperty);
        }
Ejemplo n.º 2
0
        protected override void Dispose(bool disposing)
        {
            if (_disposed)
            {
                return;
            }

            _disposed = true;
            if (Interlocked.Decrement(ref _sharedPoolCount) == 0 && Forms.IsiOS12OrNewer)
            {
                _sharedPool = null;
            }

            if (disposing)
            {
                if (IsLoading)
                {
                    StopLoading();
                }

                Element.PropertyChanged             -= HandlePropertyChanged;
                WebView.EvalRequested               -= OnEvalRequested;
                WebView.EvaluateJavaScriptRequested -= OnEvaluateJavaScriptRequested;
                WebView.GoBackRequested             -= OnGoBackRequested;
                WebView.GoForwardRequested          -= OnGoForwardRequested;
                WebView.ReloadRequested             -= OnReloadRequested;

                Element?.ClearValue(Platform.RendererProperty);
                SetElement(null);

                _events?.Dispose();
                _tracker?.Dispose();
                _packager?.Dispose();

                _events  = null;
                _tracker = null;
                _events  = null;
            }

            base.Dispose(disposing);
        }
Ejemplo n.º 3
0
        public void Apply(VisualElement styleable, bool inheriting = false)
        {
            if (styleable == null)
            {
                throw new ArgumentNullException(nameof(styleable));
            }

            foreach (var decl in Declarations)
            {
                var property = ((IStylable)styleable).GetProperty(decl.Key, inheriting);
                if (property == null)
                {
                    continue;
                }
                if (string.Equals(decl.Value, "initial", StringComparison.OrdinalIgnoreCase))
                {
                    styleable.ClearValue(property, fromStyle: true);
                }
                else
                {
                    object value;
                    if (!convertedValues.TryGetValue(decl, out value))
                    {
                        convertedValues[decl] = (value = Convert(styleable, decl.Value, property));
                    }
                    styleable.SetValue(property, value, fromStyle: true);
                }
            }

            foreach (var child in styleable.LogicalChildrenInternal)
            {
                var ve = child as VisualElement;
                if (ve == null)
                {
                    continue;
                }
                Apply(ve, inheriting: true);
            }
        }