Reputation: 4718
I'm writing a windows 8 XAML/C# app and have a little problem with the session manager.
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();
}
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.
I have a 2nd page with the SaveState method the same as the first (so as above).
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 failed: Unspecified error
Brilliant!! Not much information there!!
So, do I need to do anything different with the SuspensionManager with multiple pages?
Thanks in advance
Upvotes: 3
Views: 1515
Reputation: 5535
SuspensionManager manager works with multiple pages - no issues. given the little context, i would suggest following:
Upvotes: 2