The TaskDone method is used to determine if the
specified asynchronous task has completed. If the TaskId
parameter is omitted, the method will check the status of the last
background task that was started.
If you use this method to poll the status of a background
task from within the main UI thread, you must ensure that Windows
messages are processed so that the application remains responsive
to the end-user. To check if a background transfer has completed,
it is recommended that you use a timer to periodically call this
method rather than calling it repeatedly within a loop.
To determine if the task completed successfully, the
TaskWait method will provide the last error code associated with
the task. Note that if this method returns True, it is
guaranteed that calling TaskWait using the same task ID will
return the error code to the caller immediately without causing the
application to block.