Ejemplo n.º 1
0
 public static bool GoBack()
 {
     try
     {
         var op = HistoryOperationsBeyondFrame.Pop();
         if (!op.Invoke())
         {
             throw new InvalidOperationException();
         }
         else
         {
             return(true);
         }
     }
     catch (InvalidOperationException)
     {
         if (RootFrame.CanGoBack)
         {
             RootFrame.GoBack();
             return(true);
         }
         else
         {
             return(false);
         }
     }
 }
Ejemplo n.º 2
0
 /// <summary>
 ///
 /// </summary>
 public static void NavigateBack()
 {
     if (RootFrame.Content != null && RootFrame.CanGoBack)
     {
         RootFrame.GoBack();
     }
 }
Ejemplo n.º 3
0
 private void BackRequested(object sender, BackRequestedEventArgs e)
 {
     if (RootFrame.CanGoBack)
     {
         RootFrame.GoBack();
     }
 }
Ejemplo n.º 4
0
 private void OnBackRequested(object sender, BackRequestedEventArgs e)
 {
     if (App.OverrideBackEvent)
     {
         e.Handled = true;
     }
     else
     {
         if (RootFrame.SourcePageType == typeof(BlankPage))
         {
             RootFrame.BackStack.Clear();
             RootFrame.Navigate(typeof(HomeView));
             e.Handled = true;
         }
         else
         {
             if (RootFrame.CanGoBack)
             {
                 RootFrame.GoBack();
                 e.Handled = true;
             }
             else
             {
                 RootFrame.Navigate(typeof(HomeView));
                 e.Handled = true;
             }
         }
     }
 }
 public void GoBack()
 {
     if (RootFrame.CanGoBack)
     {
         RootFrame.GoBack();
     }
 }
Ejemplo n.º 6
0
 private void OnBackRequested(object sender, BackRequestedEventArgs e)
 {
     if (App.OverrideBackEvent)
     {
         e.Handled = true;
     }
     else
     {
         if (RootFrame.SourcePageType == typeof(BlankView))
         {
             RootFrame.BackStack.Clear();
             RootFrame.Navigate(SoundByteV3Service.Current.IsServiceConnected(ServiceType.SoundCloud)
                 ? typeof(SoundCloudStreamView)
                 : typeof(ExploreView));
             e.Handled = true;
         }
         else
         {
             if (RootFrame.CanGoBack)
             {
                 RootFrame.GoBack();
                 e.Handled = true;
             }
             else
             {
                 RootFrame.Navigate(SoundByteV3Service.Current.IsServiceConnected(ServiceType.SoundCloud)
                     ? typeof(SoundCloudStreamView)
                     : typeof(ExploreView));
                 e.Handled = true;
             }
         }
     }
 }
Ejemplo n.º 7
0
 private void PrevButton_Click(object sender, RoutedEventArgs e)
 {
     if (RootFrame.CanGoBack)
     {
         RootFrame.GoBack();
     }
 }
Ejemplo n.º 8
0
 private void BackButtonBackRequested(object sender, BackRequestedEventArgs e)
 {
     if (RootFrame.CanGoBack)
     {
         RootFrame.GoBack();
         e.Handled = true;
     }
 }
Ejemplo n.º 9
0
 private void CloseAllButton_Click(object sender, RoutedEventArgs e)
 {
     while (RootFrame.CanGoBack)
     {
         RootFrame.GoBack();
     }
     RootFrame.Navigate(null);
 }
Ejemplo n.º 10
0
 /// <summary>
 /// Ovveride with logic as to what happens when <see cref="IGestureService.GoBackRequested"/> is fired,
 /// by default it will call <see cref="Frame.GoBack()"/> if its possible.
 /// </summary>
 protected virtual void OnGoBackRequested(object sender, GestureEventArgs e)
 {
     if (!e.Handled && RootFrame.CanGoBack)
     {
         RootFrame.GoBack();
         e.Handled = true;
     }
 }
 private void OnAppBackRequested(object sender, BackRequestedEventArgs e)
 {
     if (RootFrame.CanGoBack && e.Handled == false)
     {
         e.Handled = true;
         RootFrame.GoBack();
     }
 }
Ejemplo n.º 12
0
 private void GoBack()
 {
     if (RootFrame.CanGoBack)
     {
         RootFrame.GoBack();
         RootFrame.RemoveBackEntry();
     }
 }
Ejemplo n.º 13
0
 private void RootNavigationView_OnBackRequested(NavigationView sender,
                                                 NavigationViewBackRequestedEventArgs args)
 {
     if (RootFrame.CanGoBack)
     {
         RootFrame.GoBack();
     }
 }
Ejemplo n.º 14
0
 private void RootNavigation_BackRequested(MUXC.NavigationView sender, MUXC.NavigationViewBackRequestedEventArgs args)
 {
     if (RootFrame.CanGoBack)
     {
         RootFrame.GoBack();
     }
     RootNavigation.IsBackEnabled = RootFrame.CanGoBack;
 }
Ejemplo n.º 15
0
        /// <summary>
        /// アプリケーションがエンド ユーザーによって正常に起動されたときに呼び出されます。他のエントリ ポイントは、
        /// アプリケーションが特定のファイルを開くために起動されたときなどに使用されます。
        /// </summary>
        /// <param name="e">起動の要求とプロセスの詳細を表示します。</param>
        protected override void OnLaunched(LaunchActivatedEventArgs e)
        {
#if DEBUG
            if (System.Diagnostics.Debugger.IsAttached)
            {
                this.DebugSettings.EnableFrameRateCounter = true;
            }
#endif

            Frame rootFrame = Window.Current.Content as Frame;

            // ウィンドウに既にコンテンツが表示されている場合は、アプリケーションの初期化を繰り返さずに、
            // ウィンドウがアクティブであることだけを確認してください
            if (rootFrame == null)
            {
                // ナビゲーション コンテキストとして動作するフレームを作成し、最初のページに移動します
                rootFrame = new Frame();

                rootFrame.NavigationFailed += OnNavigationFailed;

                if (e.PreviousExecutionState == ApplicationExecutionState.Terminated)
                {
                    //TODO: 以前中断したアプリケーションから状態を読み込みます
                }

                // フレームを現在のウィンドウに配置します
                Window.Current.Content = rootFrame;
            }

            if (rootFrame.Content == null)
            {
                // ナビゲーション スタックが復元されない場合は、最初のページに移動します。
                // このとき、必要な情報をナビゲーション パラメーターとして渡して、新しいページを
                //構成します
                //var appView = ApplicationView.GetForCurrentView();
                //appView.TitleBar.BackgroundColor = (Resources["ApplicationThemeBrush"] as SolidColorBrush).Color;
                ApplicationView.GetForCurrentView().SetPreferredMinSize(new Size(340, 400));
                Window.Current.SizeChanged += (s, ex) =>
                {
                    OnWindowSizeChanged(ex.Size);
                };
                SystemNavigationManager.GetForCurrentView().BackRequested += (s, ex) =>
                {
                    if (RootFrame.CanGoBack)
                    {
                        ex.Handled = true;
                        RootFrame.GoBack();
                    }
                };

                rootFrame.Navigate(typeof(MainPage), e.Arguments);

                OnWindowSizeChanged(new Size(Window.Current.Bounds.Width, Window.Current.Bounds.Height));
            }
            // 現在のウィンドウがアクティブであることを確認します
            Window.Current.Activate();
        }
Ejemplo n.º 16
0
 /// <summary>
 ///
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private static void NavigationService_BackRequested(object sender, BackRequestedEventArgs e)
 {
     // Navigate back if possible, and if the event has not
     // already been handled .
     if (RootFrame.CanGoBack && e.Handled == false)
     {
         e.Handled = true;
         RootFrame.GoBack();
     }
 }
Ejemplo n.º 17
0
        /// <summary>
        /// Navigates to the last visited page in the back stack. This method does nothing if there is no page to go back to.
        /// </summary>
        public static void NavigateBack()
        {
            if (RootFrame.CanGoBack)
            {
                int lastPageIndex = RootFrame.BackStackDepth - 1;
                _pageState = PageStates[lastPageIndex];

                RootFrame.GoBack();
                PageStates.RemoveAt(lastPageIndex);
            }
        }
Ejemplo n.º 18
0
 /// <summary>
 /// Navigates back to previous screen
 /// </summary>
 public void GoBack()
 {
     if (CanGoBack)
     {
         RootFrame.GoBack();
     }
     else
     {
         GoHome();
     }
 }
Ejemplo n.º 19
0
 /// <summary>
 /// Default Hardware/Shell Back handler overrides standard Back behavior that navigates to previous app
 /// in the app stack to instead cause a backward page navigation.
 /// Views or Viewodels can override this behavior by handling the BackRequested event and setting the
 /// Handled property of the BackRequestedEventArgs to true.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void OnBackRequested(object sender, Windows.UI.Core.BackRequestedEventArgs e)
 {
     BackRequested?.Invoke(this, e);
     if (!e.Handled)
     {
         if (this.RootFrame.CanGoBack)
         {
             RootFrame.GoBack();
             e.Handled = true;
         }
     }
 }
Ejemplo n.º 20
0
 /// <summary>
 ///     Default Hardware/Shell Back handler overrides standard Back behavior that navigates to previous app
 ///     in the app stack to instead cause a backward page navigation.
 ///     Views or Viewodels can override this behavior by handling the BackRequested event and setting the
 ///     Handled property of the BackRequestedEventArgs to true.
 /// </summary>
 /// <param name="sender"></param>
 /// <param name="e"></param>
 private void OnBackRequested(object sender, BackRequestedEventArgs e)
 {
     BackRequested?.Invoke(this, e);
     if (e.Handled)
     {
         return;
     }
     if (!RootFrame.CanGoBack)
     {
         return;
     }
     RootFrame.GoBack();
     e.Handled = true;
 }
Ejemplo n.º 21
0
        /// <summary>
        /// Default Hardware/Shell Back handler overrides standard Back behavior that navigates to previous app
        /// in the app stack to instead cause a backward page navigation.
        /// Views or Viewodels can override this behavior by handling the BackRequested event and setting the
        /// Handled property of the BackRequestedEventArgs to true.
        /// </summary>
        /// <param name="sender"></param>
        /// <param name="e"></param>
        private void OnBackRequested(object sender, Windows.UI.Core.BackRequestedEventArgs e)
        {
            if (BackRequested != null)
            {
                BackRequested(this, e);
            }

            if (!e.Handled)
            {
                if (RootFrame.CanGoBack)
                {
                    RootFrame.GoBack();
                    e.Handled = true;
                }
            }
        }
Ejemplo n.º 22
0
        private void HandleGoBack()
        {
            // Call the back event if it has been subscribed to
            if (OnBack != null)
            {
                OnBack.Invoke();
                return;
            }

            // If we can go back, go back
            if (RootFrame.CanGoBack)
            {
                RootFrame.GoBack();
                return;
            }

            // By default navigate to the xbox explore view
            RootFrame.Navigate(typeof(XboxExploreView));
        }
        public void GoBack()
        {
            if (RootFrame.CanGoBack)
            {
                RootFrame.GoBack();
            }

            OnPropertyChanged("BackButtonVisibility");

            if (sampleHistory.Count > 0)
            {
                sampleHistory.RemoveAt(sampleHistory.Count - 1);
            }

            if (sampleHistory.Count == 0)
            {
                this.PageHeader = "Start";
            }
            else
            {
                this.PageHeader = sampleHistory[sampleHistory.Count - 1].Caption;
            }
        }
        /**********************************************************************************/

        public bool GoBack()
        {
            Logger.LogEvent("Navigating Back from {0}", CurrentPage.Name);

#if (DEBUG)
            if (HomePage != null && !RootFrame.BackStack.Any() && CurrentPage != HomePage)
            {
                Logger.LogEvent("### BACKSTACK IS EMPTY, GOING TO HOMEPAGE", CurrentPage.Name);

                Navigate(HomePage);
                return(true);
            }
#endif
            NavigationMode = NavigationMode.Back;
            _parameter     = null;

            if (CanGoBack() && RootFrame.BackStack.Any())
            {
                RootFrame.GoBack();
                return(true);
            }

            return(false);
        }
Ejemplo n.º 25
0
 private void NavigationManagerOnGoBackRequested(object sender, EventArgs eventArgs)
 {
     RootFrame.GoBack();
 }
 private void BackButton_Click(object sender, RoutedEventArgs e)
 {
     RootFrame.GoBack(new SuppressNavigationTransitionInfo());
 }
 private void BackButton_Click(object sender, RoutedEventArgs e)
 {
     RootFrame.GoBack();
 }
Ejemplo n.º 28
0
 /// <summary>
 /// Navigates back to previous screen
 /// </summary>
 public void GoBack()
 {
     RootFrame.GoBack();
 }
Ejemplo n.º 29
0
 private void OnBackRequested(object sender, ModernWpf.Controls.BackRequestedEventArgs e)
 {
     RootFrame.GoBack();
 }