I was just looking into persisting the state of a Silverlight application on exit. The scenario is that the application has a complex layout that we normally persist to a database via a RESTful service call. The problem is what if the user forgets to explicitly save the layout before shutting the browser down. So I looked into calling the service in the Application_Exit method in the App class. Sadly this does not work – it appears that the request is queued on the Dispatcher thread after the shutdown process and so never executes. Guess I’ll have to save the state to isolated storage and put some hacky code in to determine if there is a saved state in ISO before loading the layout from the DB. Bit of a bummer if the user uses more than one machine though…

Advertisements