Windows手机:RemoveBackEntry导航失败后 [英] Windows Phone: RemoveBackEntry after navigate failing

查看:161
本文介绍了Windows手机:RemoveBackEntry导航失败后的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个中间加载页面我的游戏:我有给他们,它有一个显示正在加载...的文字,而相当丰厚的游戏页面加载:

I've got an intermediate "Loading" page for my game: I send them there and it has "Loading..." text that displays while the rather hefty game page loads up:

private void OnLoaded(object sender, RoutedEventArgs e)
{
    Dispatcher.BeginInvoke(() =>
        {
            try
            {
                NavigationService.Navigate(new Uri("/GamePage.xaml", UriKind.Relative));
                NavigationService.RemoveBackEntry();
            }
            catch (InvalidOperationException)
            {
            }
        });
}



然后,当你点击后退按钮,进入主网页,而不是回到加载屏幕。 。还有的页面上没有其他逻辑

Then when you hit the back button you go to the main page rather than back to the loading screen. There's no other logic on the page.

不过,我刚刚得到一个商店提交拒绝:显然在三星Focus和奥德赛的加载页面的导航条目没有得到除去,并且向用户发送回到装载页时,击中后退按钮,而不是返回到主菜单。我猜RemoveBackEntry失败。

However I just got a store submission declined: apparently on the Samsung Focus and Odyssey the navigation entry for the loading page didn't get removed, and the user is sent back to the loading page when they hit the back button, rather than back to the main menu. I'm guessing RemoveBackEntry failed.

这看起来像它应该工作,我无法重现的错误,我没有聚焦或奥德赛的工作。有谁知道什么可能会错了?

This looks like it should work, I can't reproduce the error and I don't have a Focus or Odyssey to work with. Does anybody know what might be going wrong?

推荐答案

您必须记住, NavigationService.Navigate 将执行导航的异步。所以,当你调用 NavigationService.RemoveBackEntry(),当前页面可能还没有对BackStack。

You have to remember that NavigationService.Navigate will perform the navigation asynchronously. So when you call NavigationService.RemoveBackEntry(), the current page might not yet be on the BackStack.

要解决这个问题,GamePage呼叫 RemoveBackEntry 的OnNavigatedTo

To fix that, call RemoveBackEntry in OnNavigatedTo of GamePage.

这篇关于Windows手机:RemoveBackEntry导航失败后的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆