private void OnNavigatingToPage(object sender, NavigatingCancelEventArgs e)
        {
            if (e.NavigationMode == NavigationMode.Back)
            {
                var item = (from p in this.navlist where p.DestPage == e.SourcePageType select p).SingleOrDefault();
                if (item == null && this.AppFrame.BackStackDepth > 0)
                {
                    // In cases where a page drills into sub-pages then we'll highlight the most recent
                    // navigation menu item that appears in the BackStack
                    foreach (var entry in this.AppFrame.BackStack.Reverse())
                    {
                        item = (from p in this.navlist where p.DestPage == entry.SourcePageType select p).SingleOrDefault();
                        if (item != null)
                        {
                            break;
                        }
                    }
                }

                var container = (ListViewItem)NavMenuList.ContainerFromItem(item);
                if (container != null)
                {
                    container.IsTabStop = false;
                }
                NavMenuList.SetSelectedItem(container);
                if (container != null)
                {
                    container.IsTabStop = true;
                }
            }
        }
Пример #2
0
        /// <summary>
        /// Ensures the nav menu reflects reality when navigation is triggered outside of
        /// the nav menu buttons.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void OnNavigatingToPage(object sender, NavigatingCancelEventArgs e)
        {
            if (e.NavigationMode == NavigationMode.Back)
            {
                var item = (from p in this.navlist where p.DestPage == e.SourcePageType select p).SingleOrDefault();
                if (item == null && this.AppFrame.BackStackDepth > 0)
                {
                    // In cases where a page drills into sub-pages then we'll highlight the most recent
                    // navigation menu item that appears in the BackStack
                    foreach (var entry in this.AppFrame.BackStack.Reverse())
                    {
                        item = (from p in this.navlist where p.DestPage == entry.SourcePageType select p).SingleOrDefault();
                        if (item != null)
                        {
                            break;
                        }
                    }
                }

                var container = (ListViewItem)NavMenuList.ContainerFromItem(item);

                // While updating the selection state of the item prevent it from taking keyboard focus.  If a
                // user is invoking the back button via the keyboard causing the selected nav menu item to change
                // then focus will remain on the back button.
                if (container != null)
                {
                    container.IsTabStop = false;
                }
                NavMenuList.SetSelectedItem(container);
                if (container != null)
                {
                    container.IsTabStop = true;
                }
            }
        }
Пример #3
0
        private void OnNavigatingToPage(object sender, NavigatingCancelEventArgs e)
        {
            if (e.NavigationMode == NavigationMode.Back)
            {
                var item = (from p in this.navlist where p.DestPage == e.SourcePageType select p).SingleOrDefault();
                if (item == null && this.AppFrame.BackStackDepth > 0)
                {
                    foreach (var entry in this.AppFrame.BackStack.Reverse())
                    {
                        item = (from p in this.navlist where p.DestPage == entry.SourcePageType select p).SingleOrDefault();
                        if (item != null)
                        {
                            break;
                        }
                    }
                }

                var container = (ListViewItem)NavMenuList.ContainerFromItem(item);

                if (container != null)
                {
                    container.IsTabStop = false;
                }
                NavMenuList.SetSelectedItem(container);
                if (container != null)
                {
                    container.IsTabStop = true;
                }
            }
        }
Пример #4
0
 public MainPage()
 {
     this.InitializeComponent();
     SystemNavigationManager.GetForCurrentView().BackRequested += OnBackRequested;
     NavMenuList.SelectedIndex = 0;
     NavMenuList.SetSelectedItem(NavMenuList.Items[0] as NavMenuItem);
     if (!(Microsoft.Services.Store.Engagement.StoreServicesFeedbackLauncher.IsSupported()))
     {
         FeedbackNavPaneButton.Visibility      = Visibility.Collapsed;
         FeedbackEmailNavPaneButton.Visibility = Visibility.Visible;
     }
 }
Пример #5
0
 /// <summary>
 /// Highlight a navigation button for a view or page.
 /// </summary>
 /// <param name="container"></param>
 /// <returns>True if the highlight is successful.</returns>
 private bool HighlightNavigationBtn(ListViewItem container)
 {
     // While updating the selection state of the item prevent it from taking keyboard focus.  If a
     // user is invoking the back button via the keyboard causing the selected nav menu item to change
     // then focus will remain on the back button.
     if (container != null)
     {
         container.IsTabStop = false;
         NavMenuList.SetSelectedItem(container);
         container.IsTabStop = true;
         return(true);
     }
     else
     {
         return(false);
     }
 }
        private void SyncMenu()
        {
            if (MainFrame == null)
            {
                return;
            }
            var content = MainFrame.Content as MvxWindowsPage;
            var index   = -1;

            switch (content.BaseUri.Segments[2])
            {
            case "EventsView.xaml":
                index = 0;
                break;

            case "NotificationsView.xaml":
                index = 1;
                break;

            case "RepositoriesView.xaml":
                index = 2;
                break;

            case "IssuesView.xaml":
                index = 3;
                break;

            case "GistsView.xaml":
                index = 4;
                break;
            }
            if (!IsFirstTime)
            {
                NavMenuList.SelectedIndex = -1;
                NavMenuList.SetSelectedItem();
            }
            IsFirstTime = false;
            if (index > -1)
            {
                NavMenuList.SelectedIndex = index;
                NavMenuList.SetSelectedItem(NavMenuList.Items[index] as NavMenuItem);
            }
        }
Пример #7
0
        private NavMenuItem SelectNavigationItem(NavMenuItem item)
        {
            if (item == null && AppFrame.BackStackDepth > 0)
            {
                // in cases where a page drills into sub-pages then we'll highlight the most recent
                // navigation menu item that appears in the BackStack
                foreach (var entry in AppFrame.BackStack.Reverse())
                {
                    item = GetNavigationItem(entry.SourcePageType);
                    if (item != null)
                    {
                        break;
                    }
                }
            }
            else if (item == null)
            {
                var page = AppFrame.Content as UniversalPage;
                if (page != null)
                {
                    item = GetNavigationItem(page.ParentPage);
                }
            }

            var container = GetContainerFromItem(item);

            // while updating the selection state of the item prevent it from taking keyboard focus.  If a
            // user is invoking the back button via the keyboard causing the selected nav menu item to change
            // then focus will remain on the back button.
            if (container != null)
            {
                container.IsTabStop = false;
            }

            NavMenuList.SetSelectedItem(container);
            NavMenuListBottomDock.SetSelectedItem(container);

            if (container != null)
            {
                container.IsTabStop = true;
            }
            return(item);
        }
Пример #8
0
        private void SelectNavEntryMatching(Type type)
        {
            var item = (from p in NavMenuListControls.Items where (p as NavMenuItem).DestPage == type select p).FirstOrDefault();

            if (item == null)
            {
                item = (from p in NavMenuList.Items where (p as NavMenuItem).DestPage == type select p).FirstOrDefault();
            }
            if (item == null && frame.BackStackDepth > 0)
            {
                // In cases where a page drills into sub-pages then we'll highlight the most recent
                // navigation menu item that appears in the BackStack
                foreach (var entry in frame.BackStack.Reverse())
                {
                    item = (from p in this.navlist where p.DestPage == entry.SourcePageType select p).FirstOrDefault();
                    if (item != null)
                    {
                        break;
                    }
                }
            }

            var NavMenu   = NavMenuList;
            var container = NavMenu.ContainerFromItem(item) as ListViewItem;

            if (container == null)
            {
                NavMenu   = NavMenuListControls;
                container = NavMenu.ContainerFromItem(item) as ListViewItem;
            }

            // While updating the selection state of the item prevent it from taking keyboard focus.  If a
            // user is invoking the back button via the keyboard causing the selected nav menu item to change
            // then focus will remain on the back button.
            if (container != null)
            {
                container.IsTabStop = false;
                NavMenuList.SetSelectedItem(container);
                NavMenuListControls.SetSelectedItem(container);
                container.IsTabStop = true;
            }
        }
Пример #9
0
        private void NavMenuList_SelectionChanged(object sender, SelectionChangedEventArgs e)
        {
            //Show the back button
            SystemNavigationManager.GetForCurrentView().AppViewBackButtonVisibility = AppViewBackButtonVisibility.Visible;

            //Change the title
            var selectedItem = (sender as NavMenuListView).SelectedValue;

            PageTitle.Text = (selectedItem as NavMenuItem)?.Label ?? "There should be a title here.";

            //Deselect the other item
            if (sender.Equals(NavMenuList))
            {
                NavMenuListBottom.SetSelectedItem(null);
            }
            else
            {
                NavMenuList.SetSelectedItem(null);
            }
        }
        private async void OnLoaded(object sender, RoutedEventArgs routedEventArgs)
        {
            SystemNavigationManager.GetForCurrentView().BackRequested += OnBackRequested;
            NavMenuList.SelectedIndex = 0;
            NavMenuList.SetSelectedItem(NavMenuList.Items[0] as NavMenuItem);
            if (!(Microsoft.Services.Store.Engagement.StoreServicesFeedbackLauncher.IsSupported()))
            {
                FeedbackNavPaneButton.Visibility      = Visibility.Collapsed;
                FeedbackEmailNavPaneButton.Visibility = Visibility.Visible;
            }

            NavPaneDivider.Visibility = Visibility.Collapsed;
            //ViewModel handles the navigation to the 0 index on startup so have to manually set this here.

            if (!CrossSecureStorage.Current.HasKey("OAuthToken"))
            {
                await ApiKeysManager.KeyRetriever();
            }
            await ViewModel.LoadFragments();

            await RegisterAppForStoreNotifications();
        }
Пример #11
0
        public void Navigate(NavigationPage navigationPage, object parameter)
        {
            switch (navigationPage)
            {
            case NavigationPage.BackupConfirmPage:
                MainFrame.Navigate(typeof(BackupConfirmPage), parameter);
                break;

            case NavigationPage.BackupSecretPhrasePage:
                MainFrame.Navigate(typeof(BackupSecretPhrasePage), parameter);
                break;

            case NavigationPage.ReceiveMoneyPage:
                NavMenuList.SetSelectedItem((ListViewItem)NavMenuList.ContainerFromIndex(2));
                MainFrame.Navigate(typeof(ReceiveMoneyPage), parameter);
                break;

            case NavigationPage.SendMoneyPage:
                NavMenuList.SetSelectedItem((ListViewItem)NavMenuList.ContainerFromIndex(1));
                MainFrame.Navigate(typeof(SendMoneyPage), parameter);
                break;
            }
        }