I have written code to swap configs in a windows 8 app. This needs an immediate restart of the app.
Here's what I've tried:
1) Close the application. Apparently this is forbidden by Microsoft.
2) Accepts the user's config change, then add it to Tasks to be done when the app is next closed. Using something like the Application.Exit Event in WPF, but that is missing in here. I can see OnSuspending, but that isn't sufficient because the application may be resumed with the current memory intact.
3) Restart the application. Still looking in to this one. I suspect I'd have to be quite clever about this not violate Microsoft rules like this related question
Here's what I've not tried: Hotswapping (This is dev effort and bug risk and really just isn't worth it), Locking the UI and compelling the user to close (just no) etc etc. ... Also asking nicely, I've not tried that.
I think 2 is the most likely option
- How can I schedule and run code on the closing of my application?