Windows Phone 8 中的快速应用程序恢复问题 [英] Fast App Resume issues in windows phone 8

查看:32
本文介绍了Windows Phone 8 中的快速应用程序恢复问题的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

当我在 WMAppManifest.xml 页面中设置 ActivationPolicy="Resume" 时,页面磁贴导航(导航 URL)在 Tombstone 状态下不起作用,它会重新加载最后一个返回堆栈页面(URL).它在休眠状态下工作正常,无需重新加载页面.如果不设置此属性 (ActivationPolicy="Resume"),它会在两种状态 [Dormant 状态和 Tombstone 状态] 下重新加载页面.

When i set ActivationPolicy="Resume" in WMAppManifest.xml page tile navigation(navigation URL) is not working in Tombstone state, it reloads the last back stack page(URL). It works fine with Dormant state with out reloading the page. If don't set this property (ActivationPolicy="Resume") it reloads the page in both states [Dormant state and Tombstone state].

但是当我们设置该属性时,我们如何实现到辅助网址的导航.

But how can we achieve the navigation to secondary url's, when we set that property.

请帮帮我.

推荐答案

添加 ActivationPolicy="Resume" 并不是让您的应用支持快速应用恢复所需的唯一步骤.我相信当您只设置一个属性时,您所描述的行为是正常的.我认为有几种方法可以实现快速应用恢复",但我发现这是最简单的方法.

Adding ActivationPolicy="Resume" is not the only step needed to have your app support Fast App Resume. I believe the behavior you are describing is normal when you only set that one property. I think there are a few ways to implement "Fast App Resume", but I found this to be the easiest way.

像刚才描述的那样设置激活策略,然后执行以下操作:

Set the activation policy like you just described and then do the following:

进入App.xaml.cs在App"类中添加:

Go into App.xaml.cs in the "App" class add:

   private bool reset

然后您应该有一个用于初始化 RootFrame 的 InitializePhoneApplication 方法.添加这个:

You should then have a method for InitializePhoneApplication that initializes the RootFrame. Add this:

RootFrame.Navigating += RootFrame_Navigating;
RootFrame.Navigated += RootFrame_Navigated;

然后你可以去添加这些方法:

Then you can go and add those methods:

void RootFrame_Navigating(object sender, NavigatingCancelEventArgs e)
{
    if (reset && e.IsCancelable && e.Uri.OriginalString == "/MainPage.xaml")
    {
        e.Cancel = true;
        reset = false;
    }
}

void RootFrame_Navigated(object sender, NavigationEventArgs e)
{
    reset = e.NavigationMode == NavigationMode.Reset;
}

如果您正确地实现了这一点,您的应用应该会从您所在的最后一个页面恢复.

If you implement this properly, your app should resume from the last page you were on.

这篇关于Windows Phone 8 中的快速应用程序恢复问题的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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