現在,我擁有的是,當用戶點擊頁面時,頁面會自動將用戶發送到打開pdf文件的web任務。導航循環和清除後備棧
現在發生的事情是,當用戶按下後退按鈕時,它會在返回到原始頁面之前重新導向到pdf,因爲我已將它分配給(由於onnavigateto功能)
我該如何做到這一點,以便當用戶點擊pdf文檔中的後退按鈕時,應用程序會將用戶帶回主頁面?
此外,在主頁上,我如何確保清除後臺? (由於應用程序已經退出MainPage執行,所以不能回去的PDF文件。)
到目前爲止我的代碼,我已經試過......
{
public partial class Page2 : PhoneApplicationPage
{
public Page2()
{
InitializeComponent();
}
//as soon as this page is opened, navigate/redirect it to the URL below
protected override void OnNavigatedTo(System.Windows.Navigation.NavigationEventArgs e)
{
base.OnNavigatedTo(e);
WebBrowserTask task = new WebBrowserTask() { URL ="http://test.com/test.pdf"};
task.Show();
}
//when the user clicks the hardware back button, instead of taking them to the daily notices, which will send them back to brower
// send the user to the main page
protected override void OnBackKeyPress
(System.ComponentModel.CancelEventArgs e)
{
base.OnBackKeyPress(e);
new Uri("/MainPage.xaml", UriKind.Relative);
}