public void NavigationInfoIsNullForUnregisteredPage() { var name = "UnRegisteredPage"; var info = PageNavigationRegistry.GetPageNavigationInfo(name); Assert.Null(info); }
private static Page ProcessCurrentPageNavigationPath(Page page, Stack <string> stack) { var currentPageKeyInfo = PageNavigationRegistry.GetPageNavigationInfo(page.GetType()); string currentSegment = $"{currentPageKeyInfo.Name}"; var parent = page.Parent as Page; if (parent != null) { var parentKeyInfo = PageNavigationRegistry.GetPageNavigationInfo(parent.GetType()); if (parent is TabbedPage || parent is CarouselPage) { //set the selected tab to the current page currentSegment = $"{parentKeyInfo.Name}?{KnownNavigationParameters.SelectedTab}={currentPageKeyInfo.Name}"; page = parent; } else if (parent is MasterDetailPage) { currentSegment = $"{parentKeyInfo.Name}/{currentPageKeyInfo.Name}"; page = parent; } } stack.Push(currentSegment); return(page); }
public void RegisterPageForNavigation() { PageNavigationRegistry.ClearRegistrationCache(); var name = "MainPage"; var type = typeof(PageMock); PageNavigationRegistry.Register(name, type); var info = PageNavigationRegistry.GetPageNavigationInfo(name); Assert.NotNull(info); }
private static void AddSegmentToStack(Page page, Stack <string> stack) { if (page == null) { return; } var keyInfo = PageNavigationRegistry.GetPageNavigationInfo(page.GetType()); if (keyInfo != null) { stack.Push(keyInfo.Name); } }
private void OnCurrentItemChanged(object sender, CurrentItemChangedEventArgs e) { if (sender is CarouselView carousel && carousel.CurrentItem != CurrentView && carousel.CurrentItem != null && carousel.CurrentItem is VisualElement newActiveView) { var previousView = CurrentView; CurrentView = newActiveView; if (!_region.ActiveViews.Contains(newActiveView)) { _region.Activate(newActiveView); } var info = PageNavigationRegistry.GetPageNavigationInfo(newActiveView.GetType()); var context = new NavigationContext(_region.NavigationService, new Uri(info.Name, UriKind.RelativeOrAbsolute)); MvvmHelpers.OnNavigatedFrom(previousView, context); MvvmHelpers.OnNavigatedTo(newActiveView, context); } }