問題描述
我的 WinRT metro (c# - xaml) 應(yīng)用程序有以下情況:
I have following situation in my WinRT metro (c# - xaml) application :
用戶啟動(dòng)應(yīng)用程序但他或她沒有登錄.在菜單欄中,我有將他們導(dǎo)航到購物車的按鈕.值得一提的是,無論登錄/退出狀態(tài)如何,他們都可以點(diǎn)擊它.
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.
所以我有這個(gè):
Home Page - > Login Page - > Shopping Cart
一切都很好,但是當(dāng)我嘗試在我的 購物車 頁面上按 BACK 按鈕時(shí),我被導(dǎo)航回 Login 頁面,這是有道理的,因?yàn)轫撁媸窃谖业膶?dǎo)航歷史中.但我不希望這樣,我想將用戶返回到主頁并跳過登錄頁面.
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.
我的問題是如何做到這一點(diǎn),以及如何在 WinRT 上操作框架導(dǎo)航堆棧.我嘗試了兩次返回,但沒有成功.
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.
推薦答案
你可以用不同的方式來處理它.您可以使后退按鈕多次導(dǎo)航,直到它到達(dá)主頁或跳過登錄頁面.您還可以使登錄頁面顯示在導(dǎo)航 Frame
之外 - 在彈出窗口或應(yīng)用程序的不同層中.
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 中,平臺(tái)引入了 Frame 上的 "noreferrer">BackStack
和 ForwardStack
屬性,您可以對(duì)其進(jìn)行操作.
In 8.1 the platform introduced the BackStack
and ForwardStack
properties on the Frame
which you can manipulate.
這篇關(guān)于WinRT - 如何從導(dǎo)航歷史記錄中忽略或刪除頁面的文章就介紹到這了,希望我們推薦的答案對(duì)大家有所幫助,也希望大家多多支持html5模板網(wǎng)!