GoBack() 공개 메소드

public GoBack ( ) : void
리턴 void
예제 #1
0
 public static void GoBack(Frame Frame)
 {
     if (Frame.CanGoBack)
     {
         Frame.GoBack();
     }
 }
 public static void Register(Frame frame, NavigationHelperConfig config)
 {
     Action backAction = () =>
     {
         if (frame.CanGoBack)
         {
             frame.GoBack();
         }
     };
     Register(frame, backAction);
 }
예제 #3
0
        /// <summary>
        /// Handles back button press.  If app is at the root page of app, don't go back and the
        /// system will suspend the app.
        /// </summary>
        /// <param name="sender">The source of the BackPressed event.</param>
        /// <param name="e">Details for the BackPressed event.</param>
        private void OnBackPressed(object sender, BackPressedEventArgs e)
        {
            RootFrame = Window.Current.Content as Frame;
            if (RootFrame == null)
            {
                return;
            }

            if (RootFrame.CanGoBack)
            {
                RootFrame.GoBack();
                e.Handled = true;
            }
        }
예제 #4
0
파일: App.xaml.cs 프로젝트: kusl/vlcwinrt
        /// <summary>
        /// Handles back button press.  If app is at the root page of app, don't go back and the
        /// system will suspend the app.
        /// </summary>
        /// <param name="sender">The source of the BackPressed event.</param>
        /// <param name="e">Details for the BackPressed event.</param>
        private void HardwareButtons_BackPressed(object sender, BackPressedEventArgs e)
        {
            ApplicationFrame = Window.Current.Content as Frame;
            if (ApplicationFrame == null)
            {
                return;
            }

            if (ApplicationFrame.CanGoBack)
            {
                ApplicationFrame.GoBack();
                e.Handled = true;
            }
        }
예제 #5
0
        /// <summary>
        /// Invoked when the application is launched normally by the end user.  Other entry points
        /// will be used such as when the application is launched to open a specific file.
        /// </summary>
        /// <param name="e">Details about the launch request and process.</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;

            // Do not repeat app initialization when the Window already has content,
            // just ensure that the window is active
            if (rootFrame == null)
            {
                var a= DeviceInfo.DeviceScreenSize;
                // Create a Frame to act as the navigation context and navigate to the first page
                rootFrame = new Frame();
                rootFrame.Navigated += RootFrame_Navigated;
                rootFrame.NavigationFailed += OnNavigationFailed;

                if (e.PreviousExecutionState == ApplicationExecutionState.Terminated)
                {
                    //TODO: Load state from previously suspended application
                }
                Window.Current.SizeChanged += Current_SizeChanged;
                // Place the frame in the current Window
                Window.Current.Content = rootFrame;
                SystemNavigationManager.GetForCurrentView().BackRequested += (s, ea) =>
                {
                    while (rootFrame.CanGoBack)
                    { rootFrame.GoBack(); ea.Handled = true; }
                };
            }

            if (rootFrame.Content == null)
            {
                // When the navigation stack isn't restored navigate to the first page,
                // configuring the new page by passing required information as a navigation
                // parameter
                rootFrame.Navigate(typeof(MainPage), e.Arguments);
            }
            // Ensure the current window is active
            Window.Current.Activate();
        }
        private void OnBackRequested(object sender, BackRequestedEventArgs e)
        {
            var currentPage = (BaseContentPage)this.Element;

            if (currentPage.BackButtonAction != null)
            {
                e.Handled = true;
                // Invoke the back button action
                currentPage.BackButtonAction.Invoke();
            }
            else
            {
                // Invoke the back button action
                UWPFrame rootFrame = Window.Current.Content as UWPFrame;
                if (rootFrame.CanGoBack)
                {
                    e.Handled = true;
                    rootFrame.GoBack();
                }
            }
        }
		public Page PageWithBackAndForward( ) {
			var frame = new Frame( );
			Page page = null;
			frame.Navigated += (object sender, NavigationEventArgs e) => {
				page = e.Content as Page;
			};
			frame.Navigate(typeof(Page));
			frame.Navigate(typeof(Page));
			frame.Navigate(typeof(Page));
			frame.GoBack( );

			return page;
		}
예제 #8
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

            //http://blogs.u2u.be/diederik/post/2015/07/28/A-lap-around-Adaptive-Triggers.aspx
            // Override default minimum size.
            var view = Windows.UI.ViewManagement.ApplicationView.GetForCurrentView();
            view.SetPreferredMinSize(new Size { Width = 320, Height = 480 });

            Frame rootFrame = Window.Current.Content as Frame;

            // 不要在窗口已包含内容时重复应用程序初始化,
            // 只需确保窗口处于活动状态
            if (rootFrame == null)
            {
                // 创建要充当导航上下文的框架,并导航到第一页
                rootFrame = new Frame();
                //【Win10】页面导航的实现
                //http://www.cnblogs.com/h82258652/p/4996087.html
                rootFrame.Navigated += delegate
                {
                    SystemNavigationManager.GetForCurrentView().AppViewBackButtonVisibility
                    = rootFrame.CanGoBack ? AppViewBackButtonVisibility.Visible : AppViewBackButtonVisibility.Collapsed;
                };
                SystemNavigationManager.GetForCurrentView().BackRequested += (sender, args) =>
                {
                    if (rootFrame.CanGoBack)
                    {
                        args.Handled = true;
                        rootFrame.GoBack();
                    }
                };
                rootFrame.NavigationFailed += OnNavigationFailed;

                if (e.PreviousExecutionState == ApplicationExecutionState.Terminated || e.PreviousExecutionState == ApplicationExecutionState.ClosedByUser)
                {
                    //TODO: 从之前挂起的应用程序加载状态
                    UserData.Load();
                }

                // 将框架放在当前窗口中
                Window.Current.Content = rootFrame;
            }

            if (rootFrame.Content == null)
            {
                // 当导航堆栈尚未还原时,导航到第一页,
                // 并通过将所需信息作为导航参数传入来配置
                // 参数
                rootFrame.Navigate(typeof(MainPage), e.Arguments);
            }

            if (Windows.Foundation.Metadata.ApiInformation.IsTypePresent("Windows.Phone.UI.Input.HardwareButtons"))
            {
                Windows.Phone.UI.Input.HardwareButtons.BackPressed += (s1, e1) =>
                {
                    if (rootFrame != null)
                    {
                        if (rootFrame.CanGoBack)
                        {
                            e1.Handled = true;
                            rootFrame.GoBack();
                        }
                    }
                };
            }

            // 确保当前窗口处于活动状态
            Window.Current.Activate();
        }
예제 #9
0
        /// <summary>
        /// Invoked when the application is launched normally by the end user.  Other entry points
        /// will be used such as when the application is launched to open a specific file.
        /// </summary>
        /// <param name="e">Details about the launch request and process.</param>
        private void ResiterBackMethod(Frame rootFrame)
        {
            SystemNavigationManager.GetForCurrentView().BackRequested += (s, a) =>
            {
                if (rootFrame.CanGoBack)
                {
                    rootFrame.GoBack();
                    a.Handled = true;
                }
            };

            SystemNavigationManager.GetForCurrentView().AppViewBackButtonVisibility =
                rootFrame.CanGoBack ?
                AppViewBackButtonVisibility.Visible :
                AppViewBackButtonVisibility.Collapsed;
        }
예제 #10
0
파일: App.xaml.cs 프로젝트: drukhadze/imBMW
        /// <summary>
        /// Invoked when the application is launched normally by the end user.  Other entry points
        /// will be used such as when the application is launched to open a specific file.
        /// </summary>
        /// <param name="e">Details about the launch request and process.</param>
        protected override async void OnLaunched(LaunchActivatedEventArgs e)
        {

//#if DEBUG
//            if (System.Diagnostics.Debugger.IsAttached)
//            {
//                this.DebugSettings.EnableFrameRateCounter = true;
//            }
//#endif

            Frame rootFrame = Window.Current.Content as Frame;

            // Do not repeat app initialization when the Window already has content,
            // just ensure that the window is active
            if (rootFrame == null)
            {
                // Create a Frame to act as the navigation context and navigate to the first page
                rootFrame = new Frame();

                rootFrame.NavigationFailed += OnNavigationFailed;

                if (e.PreviousExecutionState == ApplicationExecutionState.Terminated)
                {
                    //TODO: Load state from previously suspended application
                }

                Windows.UI.Core.SystemNavigationManager.GetForCurrentView().AppViewBackButtonVisibility = AppViewBackButtonVisibility.Visible;
                Windows.UI.Core.SystemNavigationManager.GetForCurrentView().BackRequested += (s, a) =>
                {
                    if (rootFrame.CanGoBack)
                    {
                        rootFrame.GoBack();
                        a.Handled = true;
                    }
                };

                /*if (ApiInformation.IsTy‌​pePresent("Windows.Ph‌​one.UI.Input.Hardware‌​Buttons")))
                {
                    Windows.Phone.UI.Input.HardwareButtons.BackPressed += (s, a) =>
                    {
                        Debug.WriteLine("BackPressed");
                        if (Frame.CanGoBack)
                        {
                            Frame.GoBack();
                            a.Handled = true;
                        }
                    };
                }*/

                // Place the frame in the current Window
                Window.Current.Content = rootFrame;
            }

            if (rootFrame.Content == null)
            {
                // When the navigation stack isn't restored navigate to the first page,
                // configuring the new page by passing required information as a navigation
                // parameter
                rootFrame.Navigate(typeof(MainPage), e.Arguments);
            }
            // Ensure the current window is active
            Window.Current.Activate();

            try
            {
                await BluetoothClient.Instance.Connect();
                //new MessageDialog("Connected").ShowAsync();
                Logger.Info("BT Connected");

                try
                {
                    var toastTemplate = ToastTemplateType.ToastText02;
                    var toastXml = ToastNotificationManager.GetTemplateContent(toastTemplate);
                    toastXml.GetElementsByTagName("text")[0].AppendChild(toastXml.CreateTextNode("BT Connected"));
                    var toast = new ToastNotification(toastXml);
                    ToastNotificationManager.CreateToastNotifier().Show(toast);
                }
                catch { }
            }
            catch (Exception ex)
            {
                //new MessageDialog("Not Connected").ShowAsync();
                Logger.Error(ex, "BT Not Connected");
            }
        }
 private void goBack(Frame frame)
 {
     if (!frame.CanGoBack)
         return;
     frame.GoBack();
 }