What is the proper way of handling logoff / shutdown / restart when the application has unsaved data? What is the proper way of handling logoff / shutdown / restart when the application has unsaved data? wpf wpf

What is the proper way of handling logoff / shutdown / restart when the application has unsaved data?


What seems to be the accepted way is to display the save as dialog regardless.

Cancelling the shutdown, then resuming it later is most certainly not an option, for the reason you state and various others.

Since simply discarding the data is unacceptable, there really is no other options.

Well, except to save the data to a temporary file, then automatically restoring them the next time the program is run. Rather like MS Word after it has crashed. Actually, the more I consider it, the better it sounds.

Edit: There's yet another avenue, namely to save continously, the way eg. MS OneNote does. What has struck me before is that, provided you implement decent multilevel undo in your application, the whole manual saving business is actually somewhat dated - an anachronism from the days when disk operations were expensive and error-prone, nowadays mostly old habit.

But I'm digressing. Anyway, it's probably not applicable to your application, since I imagine it needs to be implemented from the beginning.