Part 12 - Understanding the App’s Lifecycle and Managing State

Sign in to queue

The Discussion

  • User profile image
    Atuan

    In this lesson, I was following steps in the video,but I just got an error when I had paste the line "ManagingState.Common.SuspensionManager.RegisterFrame(rootFrame, "appFrame"); " to where it should be.
    It said that "Error 1 The name 'ManagingState' does not exist in the current context".
    What should I do ? I've checked ,and it seems that I've done nothing wrong!

  • User profile image
    Farrukhs

    Make sure that you have created your project with the name of ManagingSate and the App class resides in ManagingState namespace.

  • User profile image
    Luis

    Atuan, what happened is that your project has a different name. Say, you called your project AppLifeCycle.
    Then, it should be:
    AppLifeCycle.Common.SuspensionManager.RegisterFrame(rootFrame, "appFrame");

  • User profile image
    Luis

    Bob, of the two methods of saving a page's state (using Windows.Storage.ApplicationData.Current.LocalSettings or NavigationHelper_LoadState method) is more advisable to use? You present us with the two options, but no reflexion on the strenghts and weaknesses of each. Thanks in advance.

  • User profile image
    Genixius

    @Luis : the first, Windows.Storage.ApplicationData.Current.LocalSettings, is used in order to save datas on the device locally, in order to be able to have access to those datas at any time, when the app is suspended or terminated. We can call this save app datas. NavigationHelper_LoadState is used in order to save session datas : datas that are only needed to be saved when the app is suspended, but not when it is terminated.
    You can experience this with the app of this video : if you type something in page 1 and in page 2 in debug, and stop the debug, only the datas on page 1 will be restored when you'll restart the debug.

Add Your 2 Cents