Inheritance: NavigationPage
        public async Task ClearNavigationForPage(Type type)
        {
            CustomNavigationPage page = GetTabPageWithInitial(type);

            if (page != null)
            {
                await page.Navigation.PopToRootAsync(false);
            }
        }
        private CustomNavigationPage GetTabPageWithInitial(Type type)
        {
            CustomNavigationPage page = Children.OfType <CustomNavigationPage>()
                                        .FirstOrDefault(p =>
            {
                return(p.CurrentPage.Navigation.NavigationStack.Count > 0
                                                        ? p.CurrentPage.Navigation.NavigationStack[0].GetType() == type
                                                        : false);
            });

            return(page);
        }
        public bool TrySetCurrentPage(Type requiredPageType)
        {
            CustomNavigationPage page = GetTabPageWithInitial(requiredPageType);

            if (page != null)
            {
                CurrentPage = null;
                CurrentPage = page;
            }

            return(page != null);
        }
        public void AddPage(Page page, string title)
        {
            var navigationPage = new CustomNavigationPage(page)
            {
                Title = title,
                Icon  = GetIconForPage(page)
            };

            if (page is BookingPage || page is ReportIncidentPage)
            {
                navigationPage.IsEnabled = Settings.CurrentBookingId != 0;
            }

            if (_previousPage == null)
            {
                _previousPage = page;
            }

            Children.Add(navigationPage);
        }