static void DisposeAllDisposings()
 {
     while (PageBackStackStateService.IsDisposablePages)
     {
         var disposingPage = PageBackStackStateService.GetNextDisposablePage();
         disposingPage.Dispose();
     }
 }
 void Dispose(bool disposing)
 {
     if (disposing)
     {
         while (PageBackStackStateService.Pop())
         {
         }
         DisposeAllDisposings();
         _currentPage.Dispose();
     }
 }
        public void StartOfCycle()
        {
            if (PageBackStackStateService.IsPagePending)
            {
                _currentPage.OnNavigatingAway();
                _currentPage = PageBackStackStateService.GetPendingPage();
                _currentPage.OnNavigatingHere();
                _currentPage.Resized(_size);
                _pageChanged = true;
            }

            if (PageBackStackStateService.IsDisposablePages)
            {
                DisposeAllDisposings();
            }
        }
 public PageBackStackHost(PageBase startPage)
 {
     PageBackStackStateService.Push(startPage);
 }