当前位置: 首页>>代码示例>>C#>>正文


C# Frame.GoBack方法代码示例

本文整理汇总了C#中Windows.UI.Xaml.Controls.Frame.GoBack方法的典型用法代码示例。如果您正苦于以下问题:C# Frame.GoBack方法的具体用法?C# Frame.GoBack怎么用?C# Frame.GoBack使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Windows.UI.Xaml.Controls.Frame的用法示例。


在下文中一共展示了Frame.GoBack方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: GoBack

 public static void GoBack(Frame Frame)
 {
     if (Frame.CanGoBack)
     {
         Frame.GoBack();
     }
 }
开发者ID:icebeam7,项目名称:nexmo-game,代码行数:7,代码来源:Utils.cs

示例2: Register

 public static void Register(Frame frame, NavigationHelperConfig config)
 {
     Action backAction = () =>
     {
         if (frame.CanGoBack)
         {
             frame.GoBack();
         }
     };
     Register(frame, backAction);
 }
开发者ID:h82258652,项目名称:SoftwareKobo.UniversalToolkit,代码行数:11,代码来源:NavigationHelper.cs

示例3: OnBackPressed

        /// <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;
            }
        }
开发者ID:KonradIT,项目名称:HeyIsItOn,代码行数:20,代码来源:App.xaml.cs

示例4: HardwareButtons_BackPressed

        /// <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;
            }
        }
开发者ID:kusl,项目名称:vlcwinrt,代码行数:20,代码来源:App.xaml.cs

示例5: OnLaunched

        /// <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();
        }
开发者ID:GJian,项目名称:UWP-master,代码行数:51,代码来源:App.xaml.cs

示例6: PageWithBackAndForward

		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;
		}
开发者ID:mklemarczyk,项目名称:proj-zesp-2015-16,代码行数:13,代码来源:TC_NavigationHelper.cs

示例7: OnLaunched

        /// <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();
        }
开发者ID:YouthLin,项目名称:2048UWP,代码行数:80,代码来源:App.xaml.cs

示例8: ResiterBackMethod

        /// <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;
        }
开发者ID:modulexcite,项目名称:TrainingContent,代码行数:21,代码来源:App.xaml.cs

示例9: OnLaunched

        /// <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");
            }
        }
开发者ID:drukhadze,项目名称:imBMW,代码行数:90,代码来源:App.xaml.cs

示例10: goBack

 private void goBack(Frame frame)
 {
     if (!frame.CanGoBack)
         return;
     frame.GoBack();
 }
开发者ID:sbprasadrao,项目名称:PhotoSlides,代码行数:6,代码来源:GroupNavigationService.cs


注:本文中的Windows.UI.Xaml.Controls.Frame.GoBack方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。