Page State in Windows Phone

Now you may be wondering how the Mango Life Cycle affect our lives as developers, well the applications we build need to take that model into account. We need to anticipate that is a common for a user to hop over to another application using the start or to hit the search button for example. Also there are also common mechanism that will trigger deactivation in our application.

For example, the phone receives an incoming phone call or the user may open a launcher or chooser. Just like the people who build the platform, as developers our objective is to make the user experience SEAMLESS as a result, when the application getes deactivated we need to save our application specific data and we restore it if and when the application is reactivated. There are two types of state that we need to manage in our application, page state and application state.

Page state is a visual state of the page and its UI elements. In mango, we save and store page state in the same way with windows phone 7.

PhoneApplicationPage.OnNavigatedTo   - called before page displays
PhoneApplicationPage.OnNavigatedFrom - called before page is left.
When OnNavigatedTo is called the application may be coming from a close state if the application is just launched and this is the first page. A page earlier in the history stack(Previous Page), a page later in the history stack (Next page), A dormant state if the application is being reactivated or a tombstoned application also if the application is being reactivated. The OnNavigationFrom on the other hand may be called when the user navigates forward to another page, the user navigates back to the previous page by pressing the back button.
The application is going in a dormant mode, for example the user press the start button the application is going into a close state if the user press the back button and this page is the first page of our application. So as you can see, there are many scenarios to consider when deciding when to save and when to restore page state.

One thought on “Page State in Windows Phone

  1. I would say it can be my extremely 1st time viewing your web site. I can undoubtedly write that it contains a great number of helpful points. Excellent website. I just finished mine and i was looking for some ideas and you gave me a couple of. Great read!

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s