示例#1
0
        protected override void Dispose(bool disposing)
        {
            if (!_disposed && disposing)
            {
                if (Element != null)
                {
                    if (NavigationPage != null)
                    {
                        NavigationPage.PushRequested             -= OnPushRequested;
                        NavigationPage.PopRequested              -= OnPopRequested;
                        NavigationPage.PopToRootRequested        -= OnPopToRootRequested;
                        NavigationPage.RemovePageRequested       -= OnRemovedPageRequested;
                        NavigationPage.InsertPageBeforeRequested -= OnInsertPageBeforeRequested;
                        NavigationPage.Popped       -= OnPopped;
                        NavigationPage.PoppedToRoot -= OnPoppedToRoot;

                        NavigationPage.SendDisappearing();
                    }
                    ((Element as IPageContainer <Page>)?.CurrentPage as Page)?.SendDisappearing();
                    Element.PropertyChanged -= OnElementPropertyChanged;
                    Platform.SetRenderer(Element, null);
                    Element = null;
                }

                _tracker?.Dispose();
                _tracker = null;

                _events?.Dispose();
                _events = null;

                if (_currentStack != null)
                {
                    foreach (var childPageWrapper in _currentStack)
                    {
                        childPageWrapper.Dispose();
                    }
                    _currentStack.Clear();
                    _currentStack = null;
                }

                Platform.NativeToolbarTracker.Navigation = null;
                _disposed = true;
            }
            base.Dispose(disposing);
        }
示例#2
0
        protected override void Dispose(bool disposing)
        {
            if (disposing && !_disposed)
            {
                Element.PropertyChanged -= OnElementPropertyChanged;
                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;
                _disposed = true;
            }

            base.Dispose(disposing);
        }
示例#3
0
        protected override void Dispose(bool disposing)
        {
            if (disposing && !_disposed)
            {
                if (Carousel != null)
                {
                    Carousel.PropertyChanged -= OnElementPropertyChanged;
                    Carousel.PagesChanged    -= OnPagesChanged;
                }

                Platform.SetRenderer(Element, null);

                if (_appeared)
                {
                    _appeared = false;
                    Page?.SendDisappearing();
                }

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

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

                Element   = null;
                _disposed = true;
            }

            base.Dispose(disposing);
        }