As the name suggests, the Background Worker class allows you to set up a thread that runs continuously in the background and communicates with the main thread when needed.
BackgroundWorker implements threads in Windows Forms. Intensive tasks need to be done on another thread so that the UI doesn't freeze. After the task is completed it is necessary to publish a message and update the user interface.
The following properties are used in the BackgroundWorker class:
Reference: Microsoft Developer Network (MSDN)
Serial number | Name & Description |
---|---|
CancellationPending Value indicating whether the application requests cancellation of background operations.
td> |
|
CanRaiseEvents strong>Gets a value indicating whether the component can raise events | |
ContainerGet the IContainer containing the component.
|
|
DesignModeGets a value indicating whether the component is currently in design model. (Inherited from Component.) | |
EventGet the event attached to this component List of event handlers. | tr>|
IsBusy p>Gets a value indicating whether the BackgroundWorker is running an asynchronous operation. | |
SiteGets or sets the ISite of the component. | |
WorkerReportsProgressGets or sets a value indicating whether the BackgroundWorker can report progress renew. | |
WorkerSupportsCancellationGets or sets a value indicating whether the BackgroundWorker supports asynchronous cancellation. |
The above is the detailed content of Background worker class in C#. For more information, please follow other related articles on the PHP Chinese website!