You are designing a component for a Windows Forms application by using Microsoft Visual Studio .NET 2008 and the .NET Framework 3.5.
The component will process a long-running business transaction. You plan to provide the status of completion of the transaction to the users.
You need to ensure that the application displays a progress bar that reports the percentage of completion of the transaction.
You need to achieve this goal without using the polling method.
What should you do?
A.
Use a delegate to asynchronously invoke the component from the user interface.
Create a property in the component to expose the completion progress.
Read the property value from the user interface and display the value by using a progress bar.
B.
Use a delegate to asynchronously invoke the component from the user interface.
Raise an event from the component to report the completion progress.
Subscribe to the event from the user interface and display the percentage of completion by using a progress bar.
C.
Use a BackgroundWorker object to asynchronously invoke the component.
Set the WorkerReportsProgress property of the object to true.
Use a progress bar in the user interface to display the completion progress.
Use the ProgressChanged event to update the progress bar.
D.
Use a BackgroundWorker object to asynchronously invoke the component.
Set the WorkerReportsProgress property of the object to true.
Create a property in the component to expose the completion progress.
Read the property value from the user interface and display the value by using a progress bar.