views:

48

answers:

2

I have a document based application. Saving the document can take a few seconds, so I want to enable the user to continue using the program while it saves the document in the background.

Due to the document architecture, my application is asked to save to a temporary location and that temporary file is then copied over the old file. However, this means that I can not just run my file saving code in the background and return way before it is done, since the temporary file has to be written completely before it can be copied.

Is there a way to disable this temporary-file-behavior or otherwise enable file saving in the background?

A: 

I don't think there is a good solution for this. If you allow the user to continue working, what happens if they save again before your first save operation is complete?

I think it's probably best to just put up a save progress sheet that blocks the document until the save is complete.

Rob Keniger
The user may have multiple documents open. If saving one document can take a *really* long time (e.g., if they're saving to a network share), they may want to switch over to another document and work on that in the meantime.
Peter Hosey
Sure, and if you use a document-modal sheet to show the save progress, that is still possible.
Rob Keniger
Not if the main thread is blocked.
Peter Hosey
Fair enough :-) Good point...
Rob Keniger