Application State Persist and Restore

Topics: Prism v4 - WPF 4
Jun 19, 2010 at 3:42 PM

Hi,

I have a WPF application build with CAL guide (I'm not using Unity but I do have modules, service, shell).

I would like to have the state of my application persist and restore so that changes the user made to the UI will persist. By state I mean windows position and size, grid column order and size, selected menus, open windows, etc.

 

Sure there is an application specific part here since I can't expect a framework understand all of my application but there is sure room here for a general purpose framework or guide on how to go about this thing.

For example, where to store the state while the application is not working. If I persist everything to a single file it may get very large and restoring state will be slow.

Versioning - How to keep the data backward and forward compatible so if I remove a column from a grid the thing will not blow, also when I add new one it should get a reasonable default.

Enterprise support - This go hand-in-hand with where to persist - for enterprise application I would like my state to be in any workstation I use, not just my local computer.

 

Thank you,

Ido

 

Jul 6, 2010 at 9:43 PM

Hi Ido,

This is something not supported in Prism out-of-the-box. However, I think that it is an interesting question, so you could post your requirement in the issue tracker, so it might be taking into account for future Prism releases.

For implementing your custom persistence, you could subscribe to the application Application_StartUp and Application_Exit methods on the App.xaml.cs for persisting and restoring your app state. You can find the following related posts useful:

Fernando Antivero
http://blogs.southworks.net/fantivero

Jul 6, 2010 at 10:16 PM
I've open an issue like you suggested. [workitem:6954]