If we want to restore state in the
event the user closed the app, you can use the following code:
if(args.PreviousExecutionState == ApplicationExecutionState.Terminated
|| args.PreviousExecutionState
== ApplicationExecutionState.ClosedByUser)
{
try
{
awaitSuspensionManager.RestoreAsync();
}
if(args.PreviousExecutionState == ApplicationExecutionState.Terminated)
{
try
{
awaitSuspensionManager.RestoreAsync();
}
catch(SuspensionManagerException)
{
}
}
if(args.PreviousExecutionState == ApplicationExecutionState.Terminated
|| args.PreviousExecutionState == ApplicationExecutionState.ClosedByUser)
{
// Restore the saved session state only when appropriate
try
{
awaitSuspensionManager.RestoreAsync();
}
No comments:
Post a Comment