简体   繁体   English

Windows Phone 8.1 MainPage Frame.navigate

[英]Windows Phone 8.1 MainPage Frame.navigate

I'm creating a Windows Phone 8.1 app. 我正在创建Windows Phone 8.1应用程序。

I'm OK with simple navigation using Frame.navigate(typeof(mypage)); 我可以使用Frame.navigate(typeof(mypage));进行简单导航 and it seems to be working fine. 而且似乎工作正常。

  • I want to do some database processing on MainPage then when finished go to Page1 . 我想在MainPage上进行一些数据库处理,然后在完成后转到Page1

  • Using an event handler on button click works fine but I've put the navigation code at the end of the OnNavigatedTo function after my processing. 在按钮单击上使用事件处理程序可以很好地工作,但是在处理之后,我已将导航代码放在OnNavigatedTo函数的末尾。 Page1 doesn't load, although a debug writeline statement before and after both work so I know it's running. Page1不会加载,尽管之前和之后的调试writeline语句都可以工作,所以我知道它正在运行。

I'm sure there is an obvious reason or fix, could anyone help? 我敢肯定有明显的原因或解决办法,有人可以帮忙吗?

try wrap the navigation code in 尝试将导航代码包装在

await Windows.ApplicationModel.Core.CoreApplication.MainView.CoreWindow.Dispatcher.RunAsync(Windows.UI.Core.CoreDispatcherPriority.Normal, () =>
{
// Navigate to page 1 here
});

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM