예제 #1
0
 private void GoBack()
 {
     if (ContentFrame.CanGoBack)
     {
         ContentFrame.GoBack();
     }
 }
예제 #2
0
        protected override void OnNavigatedTo(NavigationEventArgs e)
        {
            _messenger.Register <CloseDashboard>(this, _ => DashboardPopup.Hide());

            _messenger.Register <NavigatedToOperation>(this, msg =>
            {
                switch (msg.NavigationMode)
                {
                case NavigationMode.New:
                    if (msg.Operation == null)
                    {
                        ContentFrame.Navigate(typeof(ApiInfoPage), SessionManagerVM.CurrentDocument);
                    }
                    else
                    {
                        ContentFrame.Navigate(typeof(SwaggerOperationPage), msg.Operation);
                    }
                    break;

                case NavigationMode.Back: ContentFrame.GoBack(); break;

                case NavigationMode.Forward: ContentFrame.GoForward(); break;
                }

                OperationsListView.SelectedItem = msg.Operation;
            });

            KeyDown += OnKeyDown;
            SystemNavigationManager.GetForCurrentView().BackRequested += OnBackRequested;
        }
예제 #3
0
 private void nvSample_BackRequested(Microsoft.UI.Xaml.Controls.NavigationView sender, Microsoft.UI.Xaml.Controls.NavigationViewBackRequestedEventArgs args)
 {
     if (ContentFrame.CanGoBack == true)
     {
         ContentFrame.GoBack();
     }
 }
 private void BackBtn_OnClick(object sender, RoutedEventArgs e)
 {
     if (ContentFrame.CanGoBack)
     {
         ContentFrame.GoBack();
     }
 }
예제 #5
0
 private void _HamburgerView_BackButtonClick(object sender, RoutedEventArgs e)
 {
     if (ContentFrame.CanGoBack)
     {
         ContentFrame.GoBack(new SuppressNavigationTransitionInfo());
     }
 }
예제 #6
0
파일: MainPage.xaml.cs 프로젝트: jjg0519/OA
 void HBPervious_Click(object sender, RoutedEventArgs e)
 {
     if (ContentFrame.CanGoBack)
     {
         ContentFrame.GoBack();
     }
 }
예제 #7
0
 private void NavView_OnBackRequested(Windows.UI.Xaml.Controls.NavigationView sender, NavigationViewBackRequestedEventArgs args)
 {
     if (ContentFrame.CanGoBack)
     {
         ContentFrame.GoBack();
     }
 }
예제 #8
0
        /// <summary>
        /// Handles the Navigation Request
        /// </summary>
        /// <param name="message">The Navigation goback request</param>
        public virtual void Handle(GoBackNavigationRequest message)
        {
            // Check, if we can go back
            if (!CanGoBack)
            {
                return;
            }

#pragma warning disable CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed
            // Now Go Back
            if (CurrentPage.Dispatcher.HasThreadAccess)
            {
                // When going back, delete an potential error and clear the state
                if (CurrentPage.DataContext is ViewModelBase baseModel && baseModel.IsDefective)
                {
                    baseModel.Error = string.Empty;
                }

                if (ContentFrame.CanGoBack)
                {
                    ContentFrame.GoBack();
                }
            }
            else
            {
                CurrentPage.Dispatcher.RunAsync(CoreDispatcherPriority.Normal, () => Handle(message));
            }
#pragma warning restore CS4014 // Because this call is not awaited, execution of the current method continues before the call is completed
        }
예제 #9
0
        private void BackButton_Click(object sender, RoutedEventArgs e)
        {
            if (ContentFrame.CanGoBack)
            {
                ContentFrame.GoBack();

                if (ContentFrame.SourcePageType == typeof(HomePage))
                {
                    HomeNav.IsChecked = true;
                }
                else if (ContentFrame.SourcePageType == typeof(CarsPage))
                {
                    CarsNav.IsChecked = true;
                }
                else if (ContentFrame.SourcePageType == typeof(DevicesPage))
                {
                    DevicesNav.IsChecked = true;
                }
                else if (ContentFrame.SourcePageType == typeof(ProfilePage))
                {
                    ProfileNav.IsChecked = true;
                }
                else if (ContentFrame.SourcePageType == typeof(SettingsPage))
                {
                    SettingsNav.IsChecked = true;
                }
            }
        }
예제 #10
0
        private void NavView_ItemInvoked(NavigationView sender, NavigationViewItemInvokedEventArgs args)
        {
            // 本函数处理左侧导航栏点击事件
            // 寻找点击的Item
            var item = sender.MenuItems.OfType <NavigationViewItem>().First(x => (string)x.Content == (string)args.InvokedItem);

            NavView_Navigate(item as NavigationViewItem);

            // 处理右侧Frame跳转逻辑
            if (ContentFrame.CurrentSourcePageType != typeof(NavigatorPage))
            {
                if (ContentFrame.CurrentSourcePageType != typeof(NewPage) || !ContentFrame.CanGoBack)
                {
                    ContentFrame.Navigate(typeof(NavigatorPage));
                }
                else
                {
                    ContentFrame.GoBack();
                }
            }
            else if (ContentFrame.Visibility == Visibility.Visible)
            {
                ContentFrame.Visibility = Visibility.Collapsed;
            }
            else
            {
                ContentFrame.Visibility = Visibility.Visible;
            }
        }
예제 #11
0
 private void ContentFrame_OnNavigationFailed(object sender, NavigationFailedEventArgs e)
 {
     if (ContentFrame.CanGoBack)
     {
         ContentFrame.GoBack();
     }
 }
예제 #12
0
        private void MainPage_BackRequested(object sender, BackRequestedEventArgs e)
        {
            if (!ContentFrame.CanGoBack)
            {
                e.Handled = true;
            }
            else
            {
                ContentFrame.GoBack();
                if (ContentFrame.SourcePageType == typeof(SettingsPage))
                {
                    NavView.SelectedItem = NavView.SettingsItem as NavigationViewItem;
                }
                else
                {
                    Dictionary <Type, string> lookup = new Dictionary <Type, string>()
                    {
                        { typeof(AccountPage), "account" },
                        { typeof(DashboardPage), "dashboard" }
                    };

                    String stringTag = lookup[ContentFrame.SourcePageType];
                    foreach (NavigationViewItemBase item in NavView.MenuItems)
                    {
                        if (item is NavigationViewItem && item.Tag.Equals(stringTag))
                        {
                            item.IsSelected = true;
                            break;
                        }
                    }
                }
            }
        }
예제 #13
0
        private void NavigationView_OnBackRequested(NavigationView sender, NavigationViewBackRequestedEventArgs args)
        {
            if (ContentFrame.CanGoBack)
            {
                ViewModel.SelectedItem = null;
                ContentFrame.GoBack(new SuppressNavigationTransitionInfo());

                // Reset selected item when showing browsing views.
                if (ContentFrame.Content is OfflineMapsView)
                {
                    NavigationView.SelectedItem = LocalContentMenuItem;
                }
                if (ContentFrame.Content is PortalBrowserView)
                {
                    NavigationView.SelectedItem = MyFoldersMenuItem;
                }
                if (ContentFrame.Content is PortalGroupView)
                {
                    NavigationView.SelectedItem = MyGroupsMenuItem;
                }
                if (ContentFrame.Content is SearchPage)
                {
                    NavigationView.SelectedItem = SearchMenuItem;
                }
            }
            ContentFrame.BackStack.Clear();
        }
예제 #14
0
 private void NavView_BackRequested(NavigationView sender, NavigationViewBackRequestedEventArgs args)
 {
     if (ContentFrame.CanGoBack)
     {
         ContentFrame.GoBack();
     }
 }
예제 #15
0
 private void BackwardButton1_Click(object sender, RoutedEventArgs e)
 {
     if (ContentFrame.BackStackDepth > 0)
     {
         ContentFrame.GoBack();
     }
 }
예제 #16
0
 private void Back_Click(object sender, RoutedEventArgs e)
 {
     if (!(ContentFrame.Content is ChatPage))
     {
         ContentFrame.GoBack();
     }
 }
예제 #17
0
 private void NavigateBackward(object sender, RoutedEventArgs e)
 {
     if (ContentFrame.BackStackDepth() > 0)
     {
         ContentFrame.GoBack();
     }
 }
예제 #18
0
 private void backButton_Tapped(object sender, TappedRoutedEventArgs e)
 {
     if (ContentFrame.CanGoBack)
     {
         ContentFrame.GoBack();
         Main.IsSelected = true;
     }
 }
예제 #19
0
 private void backbtn_Click(object sender, RoutedEventArgs e)
 {
     forwardbtn.Visibility = Visibility.Visible;
     if (ContentFrame.CanGoBack)
     {
         ContentFrame.GoBack();
     }
 }
예제 #20
0
 private void ContentFrameBackToShell()
 {
     // 退到最上层
     while (ContentFrame.CanGoBack)
     {
         ContentFrame.GoBack();
     }
 }
 private void On_BackRequested(object sender, BackRequestedEventArgs e)
 {
     if (!e.Handled && ContentFrame.CanGoBack)
     {
         ContentFrame.GoBack();
         e.Handled = true;
     }
 }
예제 #22
0
 private void OnBackRequested(object sender, BackRequestedEventArgs e)
 {
     if (ContentFrame.CanGoBack)
     {
         e.Handled = true;
         ContentFrame.GoBack();
     }
 }
예제 #23
0
 private void NavView_BackRequested(NavigationView sender, NavigationViewBackRequestedEventArgs args)
 {
     ContentFrame.GoBack();
     ContentFrame.ContentRendered += delegate
     {
         var pageType = ContentFrame.Content.GetType();
         NavView.Header = App.LocalizedStrings.Where(x => x.Key == pageType.Name + "Header")?.FirstOrDefault().Value;
     };
 }
예제 #24
0
        public void GoBack(object parameter = null)
        {
            if (ContentFrame.BackStack.Count > 0)
            {
                ContentFrame.GoBack();
            }

            ViewModel.LoadProfiles();
        }
예제 #25
0
        private void BackRequested(object sender, BackRequestedEventArgs e)
        {
            //Frame rootFrame = Window.Current.Content as Frame;
            //if (rootFrame == null)
            //    return;
            //if (rootFrame.CanGoBack && e.Handled == false)
            //{
            //    e.Handled = true;

            //}
            if (needtwoback)
            {
                ContentFrame.GoBack();
                if (ContentFrame.CanGoBack)
                {
                    ContentFrame.GoBack();
                }
                needtwoback = false;
            }
            else
            {
                ContentFrame.GoBack();
            }
            var currentFrame_back = (ContentFrame as Frame).CurrentSourcePageType.Name;

            switch (currentFrame_back)
            {
            case "Main":
                Main.IsSelected = true;
                needtwoback     = true;
                break;

            case "Camera":
                Camera.IsSelected = true;
                needtwoback       = true;
                break;

            case "edit":
                EditPhoto.IsSelected = true;
                needtwoback          = true;
                break;

            case "favorite":
                Collection.IsSelected = true;
                needtwoback           = true;
                break;

            case "join":
                Puzzle.IsSelected = true;
                needtwoback       = true;
                break;

            case "set":

                break;
            }
        }
        private void GoBack_Click(object sender, RoutedEventArgs e)
        {
            if (ContentFrame.CanGoBack)
            {
                ContentFrame.GoBack();
            }

            GoBack.IsChecked = false;
        }
예제 #27
0
 private bool On_BackRequested()
 {
     if (ContentFrame.CanGoBack)
     {
         ContentFrame.GoBack();
         return(true);
     }
     return(false);
 }
예제 #28
0
 private void NavigationView_BackRequested(NavigationView sender, NavigationViewBackRequestedEventArgs args)
 {
     if (ContentFrame.CanGoBack)
     {
         var context = DataContext as HomeViewModel;
         context.FakeGoBack.Execute(); // MY BUG! not every time this works & I have now idea why
         ContentFrame.GoBack();
     }
 }
예제 #29
0
 public bool TryGoBack()
 {
     if (ContentFrame.CanGoBack)
     {
         ContentFrame.GoBack();
         return(true);
     }
     return(false);
 }
예제 #30
0
        private void TopLevelNav_OnBackRequested(NavigationView sender, NavigationViewBackRequestedEventArgs args)
        {
            if (ContentFrame.CanGoBack)
            {
                ContentFrame.GoBack();
            }

            TopLevelNav.SelectedItem  = ContentFrame.Content is SettingsPage ? null : TopLevelNav.MenuItems[0];
            TopLevelNav.IsBackEnabled = ContentFrame.CanGoBack;
        }