Пример #1
0
        public void AddNavigationRoute(string displayText, Type navigationViewModel, string symbol = "", string pageHeader = null)
        {
            if (navigationItems.Any(x => x.DisplayText.Equals(displayText)))
            {
                return;
            }

            NepAppUINavigationItem navItem = new NepAppUINavigationItem();

            navItem.DisplayText = displayText;
            navItem.Symbol      = symbol;
            navItem.Icon        = new FontIcon()
            {
                Glyph = symbol
            };
            navItem.NavigationViewModelType = navigationViewModel;
            navItem.PageHeaderText          = pageHeader ?? displayText;
            navItem.Command = new RelayCommand(x =>
            {
                NavigateToItem(navItem, x);
            });
            navigationItems.Add(navItem);

            NavigationRouteAdded?.Invoke(this, new NepAppUIManagerNavigationRouteAddedEventArgs(navItem));
        }
Пример #2
0
        internal void UpdateSelectedNavigationItems()
        {
            var pageType = ((FrameNavigationService)inlineNavigationService).NavigationFrame.CurrentSourcePageType;

            foreach (NepAppUINavigationItem navItem in navigationItems)
            {
                navItem.IsSelected = false;
            }

            var navigationManager = WindowManager.GetNavigationManagerForCurrentView();

            NepAppUINavigationItem item = null;

            item = navigationItems.FirstOrDefault(x =>
            {
                var navInfo = navigationManager.GetViewModelInfo(x.NavigationViewModelType);
                return(pageType == navInfo.ViewType);
            });

            if (item != null)
            {
                item.IsSelected = true;
                ViewTitle       = item.DisplayText;
            }
            else
            {
                ViewTitle = "";
            }
        }
Пример #3
0
        public void NavigateToItem(NepAppUINavigationItem navItem, object parameter = null)
        {
            if (inlineNavigationService == null)
            {
                throw new InvalidOperationException(nameof(inlineNavigationService) + " is null.");
            }

            if (!((FrameNavigationService)inlineNavigationService).IsNavigatedTo(navItem.NavigationViewModelType))
            {
                ((FrameNavigationService)inlineNavigationService).Navigate(navItem.NavigationViewModelType, parameter);
            }

            //UpdateSelectedNavigationItems();

            ViewTitle = navItem.PageHeaderText;
        }
 internal NepAppUIManagerNavigationRouteAddedEventArgs(NepAppUINavigationItem navItem)
 {
     NavigationItem = navItem;
 }