1

When my WP7 app comes back from being Tombstoned, it creates the ViewModelLocator class that I have stored in App.Resources. How do are you suppose to handle this? In my ViewModelLocator constructor there are several ViewModels being created and in those constructors there are several WCF Service calls. It seems wrong to let this class be recreated every time it comes back from being tombstoned.

It seems like I need to serialize the ViewModelLocator before my app gets Tombstoned, and deserialize it after. Sound correct??? and is there something in MVVM-Light to handle this?

Tyler
  • 1,019
  • 12
  • 27

1 Answers1

1

You definitely need to save your data to be able to restore it after tombstoning.

MVVM Light provides the MVVM framework for you, not the WP7 data storage solution. You'll need to implement this yourself using whatever storage format is most suitable for you and Isolated Storage.

Here's a basic examples that uses IsolatedStorageSettings... a dictionary based abstraction provided by the WP7 SDK.

Tombstoning on the Win7 Mobile Platform

Mick N
  • 14,892
  • 2
  • 35
  • 41
  • Is there any type of pattern I should use for this? Seems like I'll have to take the ViewModelLocator out of App.Resources make it a singleton and take care of creating/serializing/deserializing it in the Application_Activated and Application_Deactivated. But I'm not sure if making it a singleton is a good idea and if it will somehow screw up my View bindings – Tyler Dec 28 '10 at 02:58