Question

If the app is terminated by the system I want the app to go back to whatever page the user was using last and let them pick up where they left off. The problem I'm having is that 1. My app has 2 pages, a data page and a login page, so how can I tell which page the user was last on? 2. I tried to have it navigate to the data page when launched from a terminated state as such:

    if (args.PreviousExecutionState == ApplicationExecutionState.Terminated)
            {
                rootFrame.Navigate(typeof(Messages), args.Arguments);
            }

According to http://msdn.microsoft.com/en-us/library/windows/apps/hh464925.aspx, I should load the data I saved as if I'm resuming from a suspended state, but in my LoadState method for that page, the

    if (pageState == null)

check is always true when resuming from a terminated state. The problem is that the eventargs passed when launched has a NavigationMode set to New, so its treated like its the first time it's seen the page. What should I do to get around this so I can load the saved data?

Was it helpful?

Solution

Turns out you need to use the SuspensionManager

http://msdn.microsoft.com/en-us/library/windows/apps/hh986968.aspx

Takes care of both issues.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top