Exemple #1
0
        protected override void Dispose(bool disposing)
        {
            if (_disposed)
            {
                return;
            }

            if (disposing)
            {
                (this as IDisconnectable).Disconnect();

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

                Element = null;
                Container?.Dispose();
                _pageContainer = null;
            }

            _disposed = true;

            base.Dispose(disposing);
        }
Exemple #2
0
        protected override void Dispose(bool disposing)
        {
            if (disposing)
            {
                MessagingCenter.Unsubscribe <IVisualElementRenderer>(this, UpdateToolbarButtons);

                foreach (var childViewController in ViewControllers)
                {
                    childViewController.Dispose();
                }

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

                _secondaryToolbar.RemoveFromSuperview();
                _secondaryToolbar.Dispose();
                _secondaryToolbar = null;

                _parentMasterDetailPage = null;
                Current = null;                 // unhooks events

                var navPage = (NavigationPage)Element;
                navPage.PropertyChanged -= HandlePropertyChanged;

                var navController = ((INavigationPageController)navPage);
                navController.PushRequested             -= OnPushRequested;
                navController.PopRequested              -= OnPopRequested;
                navController.PopToRootRequested        -= OnPopToRootRequested;
                navController.RemovePageRequested       -= OnRemovedPageRequested;
                navController.InsertPageBeforeRequested -= OnInsertPageBeforeRequested;
            }

            base.Dispose(disposing);
            if (_appeared)
            {
                PageController.SendDisappearing();

                _appeared = false;
            }
        }
Exemple #3
0
        protected override void Dispose(bool disposing)
        {
            if (disposing)
            {
                if (IsLoading)
                {
                    StopLoading();
                }

                Element.PropertyChanged    -= HandlePropertyChanged;
                WebView.EvalRequested      -= OnEvalRequested;
                WebView.GoBackRequested    -= OnGoBackRequested;
                WebView.GoForwardRequested -= OnGoForwardRequested;

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

            base.Dispose(disposing);
        }
Exemple #4
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);
        }
Exemple #5
0
        protected override void Dispose(bool disposing)
        {
            if (disposing && !_disposed)
            {
                Element.PropertyChanged -= OnHandlePropertyChanged;
                Platform.SetRenderer(Element, null);
                if (_appeared)
                {
                    Page.SendDisappearing();
                }

                _appeared = false;

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

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

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

                Element = null;
                Container?.Dispose();
                _pageContainer = null;
                _disposed      = true;
            }

            base.Dispose(disposing);
        }