SuspensionManager当应用程序已超过1页在Windows 8 XAML / C#应用程序错误 [英] SuspensionManager Error when application has more than 1 page in windows 8 XAML/C# app
问题描述
我正在写一个Windows 8的XAML / C#应用程序,并与会话管理器有点问题。
I'm writing a windows 8 XAML/C# app and have a little problem with the session manager.
在我App.xaml.cs我OnSuspending方法如下像这样的:
Within my App.xaml.cs my OnSuspending method looks like this:
private async void OnSuspending(object sender, SuspendingEventArgs e)
{
var deferral = e.SuspendingOperation.GetDeferral();
//TODO: Save application state and stop any background activity
await SuspensionManager.SaveAsync();
deferral.Complete();
}
我已经临时用户我rootFrame与在App.xaml中的OnLaunched方法SuspensionManager的.cs:
I have registed my rootFrame with the SuspensionManager in the OnLaunched method in App.xaml.cs:
SuspensionManager.RegisterFrame(rootFrame, "AppFrame");
所以,在我的应用程序的第一页,我已经重写了即时存档方法。它看起来是这样的:
So, in the first page of my app I have overriden the SaveState method. It looks like this:
protected override void SaveState(Dictionary<string, object> pageState)
{
Save(true);
base.SaveState(pageState);
}
当应用程序被停用了此方法被调用,这一切工作正常。
When the application is suspended this method is called and it all works fine.
我与即时存档方法的第2页相同的第一个(如上述如此)。
I have a 2nd page with the SaveState method the same as the first (so as above).
当我导航到第2页从我的第一页,并暂停该应用程序,无论是即时存档方法被调用,应用程序崩溃,出现以下错误:
When I navigate to the 2nd page from my 1st page and suspend the application neither of the SaveState methods are called and the application crashes with the following error:
SuspensionManager失败:未指定的错误
SuspensionManager failed: Unspecified error
辉煌!没有太多的信息有!!
Brilliant!! Not much information there!!
所以,我需要做任何多页的SuspensionManager不同?
So, do I need to do anything different with the SuspensionManager with multiple pages?
在此先感谢
推荐答案
SuspensionManager Manager与多页 - 没有问题。鉴于小的背景下,我建议如下:
SuspensionManager manager works with multiple pages - no issues. given the little context, i would suggest following:
- 请问您创造一个VS项目时是自动生成的共同文件进行任何更改
使用网格的应用程序模板?如果是的话 - 尝试建立一个新的项目 - 您是否传递是在frame.navigate调用非序列化的参数?这是不可能的,因为在这种情况下 - 你可以在输出窗口像这样看 - WinRT的信息:GetNavigationState不支持被传递给Frame.Navigate参数类型的序列化
这篇关于SuspensionManager当应用程序已超过1页在Windows 8 XAML / C#应用程序错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!