By asking, "How can I command BackgroundWorkerto complete this work, and then WAIT so that the employee can complete, while maintaining the graphical interface?" really asks: "How to use BackgroundWorker?". What does BackgroundWorker.
When you write a background task, you basically break the method into four parts:
- Preparation for the task.
- The task itself.
- Report on progress in the user interface during task execution.
- Cleaning an object when performing a task.
, . - , BackgroundWorker, DoWork, ProgressChanged RunWorkerCompleted, , , RunWorkerAsync, .
. DoWork - DoWorkEventHandler, , ReportProgress , . ProgressChanged - ProgressChangedEventHandler, ReportProgress. RunWorkerCompleted - RunWorkerCompletedEventHandler, , .
, .
, . -, , Error . , , , , , , . ( , .)
-, , DoWorkEventHandler . , MVVM, , , , , , , , - . , INotifyPropertyChanged, - , PropertyChanged .
, . . " ", . , , , , , . , .
: , , . - , - , Error , . , , , , , - .