1

Lets assume I have two pages MainPage and DetailsPage. In details page user hits on start button then hits on the back button to get to the Previous Page. And If we don't have tombstone coding they will have blank page.Example

Is it possible to resume the application from the MainPage (not the detailspage) when they hit back button.

Kind regards.

nacon
  • 95
  • 6

1 Answers1

3

I'm not sure if this is possible via a built-in code path, but you can detect when the phone is activating from tombstone using the PhoneApplicationService.Activated event. When this occurs, you could manually navigate the phone to your main page either directly or via programmatic back button presses.

I would argue against all of that though. Your app should serialize the data to isolated storage and restore it properly. This is the expected behaviour users will want to see inside WP7 apps in my opinion.

http://www.imaginativeuniversal.com/blog/post/2010/08/22/WP7-Tombstoning-Pattern-Tip.aspx

Update: from Claus in the comments below. You can also utilise the query string on the URL. This is automatically persisted when the app is tombstoned. This query string can be used to trigger the loading of data again, to save you from serializing the entire set. In your case it looks as though you are fetching data from the web, so the query string will work well for you.

However, you need to weigh that against adding pressure to the user's phone data plan. If serializing the set is a cheap action, I'd say go that route.

Adam Houldsworth
  • 63,413
  • 11
  • 150
  • 187
  • I second Adam's comment. It is unlikely your app will pass certification for the marketplace with this behavior. – 1adam12 Jul 18 '11 at 10:28
  • Adam thanks for your reply, I think you are right. It wouldn't be nice to do. – nacon Jul 18 '11 at 10:29
  • 1
    The ideal way to do it, is to use a QueryString as part of your navigation. Use the Tweet's unique id, and load it based on that, instead of setting the datacontext to the selected item (as I'm assuming you're doing now) – Claus Jørgensen Jul 18 '11 at 11:00
  • @Claus would that query string persist through tombstoning? – Adam Houldsworth Jul 18 '11 at 11:01
  • Yes, the query string is persisted automatically by the phone. So when you click the back button, it'll be the same navigation url as before, including the query string. – Claus Jørgensen Jul 18 '11 at 11:06
  • @Claus I'll update my answer with that gem - and I'll be remembering that myself! – Adam Houldsworth Jul 18 '11 at 11:07
  • Claus thank you for your guidance. Can you also have a look at my new question about saving query. http://stackoverflow.com/questions/6772588/wp7-tombstoning-and-querystring – nacon Jul 21 '11 at 07:21