【发布时间】:2012-03-01 08:18:30
【问题描述】:
现在,我所拥有的是,当用户点击页面时,页面会自动将用户发送到打开 pdf 文件的 webtask。
现在发生的情况是,当用户按下后退按钮时,它会在一瞬间返回原始页面,然后被重定向回我分配给它的 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);
}
【问题讨论】:
标签: windows windows-phone-7 navigation