This project is read-only.

what does it store when calling SaveState?

Feb 17, 2012 at 9:35 PM

my app is very simple, it has a stack panel which, UserControls are added to when clicking on a button like so:-

void btnAddPlayer_Click(object sender, EventArgs e)
	PlayerControl sbItem = new PlayerControl();

Playercontrol is a simple control inherited from UserControl, it has 2 textboxes on it...

when I switch between apps everything is ok, its only tombstoned if you switch to the main menu and then load the app from the menu (instead of just switching/multi-tasking back to it)

when it is tombstoned the controls are no longer in the stackpanel... Id like it to be able to reload all of the added PlayerControls (and whatever text is set... and if possible there are some variables that are set aswell when the textbox is changed) ... with as little code as possible :)

any ideas?


Mar 6, 2012 at 8:36 PM
Edited Mar 6, 2012 at 8:41 PM

If you switch to the main menu and then launch the app from there, you are not recovering from tombstoning, you are launching a new instance of the app. The standard behaviour for such an action is to not restore the state of the app.

If you're just testing by hitting Start and then Back, then you're probably not even Tombstoning, just FastAppSwitching. The easiest way to test tombstoning is to select the option in the debug menu under project properties.

Unless you've built your own object which implements `ICanTombstone` or you're persisting the ViewModel then the library will not be able to restore the objects you're adding to ctlPanel.

To be clear you are not tombstoning if you launch a new instance of the app.

TombstoneHelper only supports tombstoning, not persisting information between instances of apps. If you want to persist information or state between app instances you'll need to do that yourself and put the information in IsolatedStorgeSettings or a file in IsolatedStorage.

For an example of what's saved, you can examine the State property of the page after calling SaveState().
Alternatively, you can see what and how state is saved for each type by looking at the Save() method in each of the XxxxxTombstoner files.