Class QueuedBackgroundWorker
A background worker with a work queue.
Inheritance
Implements
Inherited Members
Namespace: Manina.Windows.Forms
Assembly: ImageListView.dll
Syntax
[ToolboxBitmap(typeof(QueuedBackgroundWorker))]
public class QueuedBackgroundWorker : Component, IComponent, IDisposable
Constructors
| Improve this Doc View SourceQueuedBackgroundWorker()
Initializes a new instance of the QueuedBackgroundWorker class.
Declaration
public QueuedBackgroundWorker()
Properties
| Improve this Doc View SourceIsBackground
Gets or sets a value indicating whether or not the worker thread is a background thread.
Declaration
[Browsable(true)]
public bool IsBackground { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
PriorityQueues
Gets or sets the number of priority queues. Number of queues cannot be changed after any work is added to the work queue.
Declaration
[Browsable(true)]
public int PriorityQueues { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Int32 |
ProcessingMode
Represents the mode in which the work items are processed. Processing mode cannot be changed after any work is added to the work queue.
Declaration
[Browsable(true)]
public ProcessingMode ProcessingMode { get; set; }
Property Value
| Type | Description |
|---|---|
| ProcessingMode |
Started
Determines whether the QueuedBackgroundWorker started working.
Declaration
[Browsable(false)]
public bool Started { get; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
ThreadName
Represents the name of the worker threads.
Declaration
[Browsable(true)]
public string ThreadName { get; set; }
Property Value
| Type | Description |
|---|---|
| System.String |
Threads
Gets or sets the number of worker threads. Number of threads cannot be changed after any work is added to the work queue.
Declaration
[Browsable(true)]
public int Threads { get; set; }
Property Value
| Type | Description |
|---|---|
| System.Int32 |
Methods
| Improve this Doc View SourceCancelAsync()
Cancels all pending operations in all queues.
Declaration
public void CancelAsync()
CancelAsync(Int32)
Cancels all pending operations in the given queue.
Declaration
public void CancelAsync(int priority)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | priority | A value between 0 and PriorityQueues indicating the priority queue to cancel. |
CancelAsync(Object)
Cancels processing the item with the given key.
Declaration
public void CancelAsync(object argument)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Object | argument | The argument of an asynchronous operation. |
Dispose(Boolean)
Releases the unmanaged resources used by the System.ComponentModel.Component and optionally releases the managed resources.
Declaration
protected override void Dispose(bool disposing)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Boolean | disposing | true to release both managed and unmanaged resources; false to release only unmanaged resources. |
Overrides
GetApartmentState()
Gets the apartment state of worker threads.
Declaration
public ApartmentState GetApartmentState()
Returns
| Type | Description |
|---|---|
| System.Threading.ApartmentState | The apartment state of worker threads. |
OnDoWork(QueuedWorkerDoWorkEventArgs)
Raises the DoWork event.
Declaration
protected virtual void OnDoWork(QueuedWorkerDoWorkEventArgs e)
Parameters
| Type | Name | Description |
|---|---|---|
| QueuedWorkerDoWorkEventArgs | e | A QueuedWorkerDoWorkEventArgs that contains event data. |
OnRunWorkerCompleted(QueuedWorkerCompletedEventArgs)
Raises the RunWorkerCompleted event.
Declaration
protected virtual void OnRunWorkerCompleted(QueuedWorkerCompletedEventArgs e)
Parameters
| Type | Name | Description |
|---|---|---|
| QueuedWorkerCompletedEventArgs | e | A QueuedWorkerCompletedEventArgs that contains event data. |
Pause()
Pauses the worker.
Declaration
public void Pause()
Resume()
Resumes processing pending operations in the work queue.
Declaration
public void Resume()
RunWorkerAsync()
Starts processing a new background operation.
Declaration
public void RunWorkerAsync()
RunWorkerAsync(Object)
Starts processing a new background operation.
Declaration
public void RunWorkerAsync(object argument)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Object | argument | The argument of an asynchronous operation. |
RunWorkerAsync(Object, Int32)
Starts processing a new background operation.
Declaration
public void RunWorkerAsync(object argument, int priority)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Object | argument | The argument of an asynchronous operation. |
| System.Int32 | priority | A value between 0 and PriorityQueues indicating the priority of this item. An item with a higher priority will be processed before items with lower priority. |
RunWorkerAsync(Object, Int32, Boolean)
Starts processing a new background operation.
Declaration
public void RunWorkerAsync(object argument, int priority, bool single)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Object | argument | The argument of an asynchronous operation. |
| System.Int32 | priority | A value between 0 and PriorityQueues indicating the priority of this item. An item with a higher priority will be processed before items with lower priority. |
| System.Boolean | single | true to run this operation without waiting for queued items; otherwise false to add this operatino to th queue. |
SetApartmentState(ApartmentState)
Sets the apartment state of worker threads. The apartment state cannot be changed after any work is added to the work queue.
Declaration
public void SetApartmentState(ApartmentState state)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Threading.ApartmentState | state | The new state of worker threads. |
Events
| Improve this Doc View SourceDoWork
Occurs when RunWorkerAsync(Object, Int32) is called.
Declaration
[Browsable(true)]
public event QueuedWorkerDoWorkEventHandler DoWork
Event Type
| Type | Description |
|---|---|
| Manina.Windows.Forms.QueuedWorkerDoWorkEventHandler |
RunWorkerCompleted
Occurs when the background operation of an item has completed, has been canceled, or has raised an exception.
Declaration
[Browsable(true)]
public event RunQueuedWorkerCompletedEventHandler RunWorkerCompleted
Event Type
| Type | Description |
|---|---|
| Manina.Windows.Forms.RunQueuedWorkerCompletedEventHandler |