WinRT - 如何从导航历史记录中忽略或删除页面

WinRT - How to ignore or delete page from navigation history(WinRT - 如何从导航历史记录中忽略或删除页面)
本文介绍了WinRT - 如何从导航历史记录中忽略或删除页面的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着跟版网的小编来一起学习吧!

问题描述

我的 WinRT metro (c# - xaml) 应用程序有以下情况:

I have following situation in my WinRT metro (c# - xaml) application :

用户启动应用程序但他或她没有登录.在菜单栏中,我有将他们导航到购物车的按钮.值得一提的是,无论登录/退出状态如何,他们都可以点击它.

User launch the application and he or she is not logged in. In the menu bar I have button which navigates them to Shopping cart. It's important to mention that they can click on it regardless of logged in/out status.

所以我有这个:

Home Page - > Login Page - > Shopping Cart

一切都很好,但是当我尝试在我的 购物车 页面上按 BACK 按钮时,我被导航回 Login 页面,这是有道理的,因为页面是在我的导航历史中.但我不希望这样,我想将用户返回到主页并跳过登录页面.

And everything works great, but when I try press BACK button on my Shopping Cart page I'm navigated back to Login Page, which make sense, because page is in my navigation history. But I don't want that, I want to return user to Home Page and skip login page.

我的问题是如何做到这一点,以及如何在 WinRT 上操作框架导航堆栈.我尝试了两次返回,但没有成功.

My question is how to do that, and how to manipulate Frame Navigation Stack on WinRT. I tried with going Back twice, but with no luck.

顺便说一句,我的页面是LayoutAwarePage"页面,我正在使用与此类似的 NavigationServicehttp://dotnetbyexample.blogspot.com/2012/06/navigationservice-for-winrt.html.

Btw, my page is "LayoutAwarePage" page and I'm using NavigationService similar to this http://dotnetbyexample.blogspot.com/2012/06/navigationservice-for-winrt.html.

推荐答案

你可以用不同的方式来处理它.您可以使后退按钮多次导航,直到它到达主页或跳过登录页面.您还可以使登录页面显示在导航 Frame 之外 - 在弹出窗口或应用程序的不同层中.

You can approach it in different ways. You can make it so the back button navigates back multiple times until it reaches the home page or skips through the log in page. You could also make the log in page something that shows up outside of the navigation Frame - either on a popup or in a different layer in the application.

*更新

在 8.1 中,平台引入了 Frame 上的 "noreferrer">BackStackForwardStack 属性,您可以对其进行操作.

In 8.1 the platform introduced the BackStack and ForwardStack properties on the Frame which you can manipulate.

这篇关于WinRT - 如何从导航历史记录中忽略或删除页面的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持跟版网!

本站部分内容来源互联网,如果有图片或者内容侵犯了您的权益,请联系我们,我们会在确认后第一时间进行删除!

相关文档推荐

Custom Error Queue Name when using EasyNetQ for RabbitMQ?(使用 EasyNetQ for RabbitMQ 时自定义错误队列名称?)
How to generate password_hash for RabbitMQ Management HTTP API(如何为 RabbitMQ 管理 HTTP API 生成密码哈希)
Rabbitmq Ack or Nack, leaving messages on the queue(Rabbitmq Ack 或 Nack,将消息留在队列中)
Setup RabbitMQ consumer in ASP.NET Core application(在 ASP.NET Core 应用程序中设置 RabbitMQ 消费者)
Specify Publish timeouts in mass transit(指定公共交通中的发布超时)
RabbitMQ asynchronous support(RabbitMQ 异步支持)