You are busy using a BackgroundWorker component, set to its default value, to execute an
asynchronous operation.
What should you do to receive notification when the operation completes?
A.
You should handle the ProgressChanged event.
B.
You should handle the RunWorkerCompleted event.
C.
You should call the WaitAny method of the WaitHandle class.
D.
You should call the WaitAll method of the WaitHandle class.
Explanation:
The BackgroundWorker class has a method called RunWorkerCompleted, when called; it raises a DoWork event in a separate thread. When ever the background thread is complete, the component raises the RunWorkerCompleted event.Incorrect Answers:
A: The ProgressChanged is raised when the background thread calls the ReportProgress method.
C: The WaitAny causes the current thread to block until at least one wait handle in the specified WaitHandle array is signaled as complete.
D: The WaitAll causes the current thread to block until one wait handle in the specified WaitHandle array is signaled as complete.
B: Announce the completion of a background process by using the BackgroundWorker component.