C# Class ImageGlass.ImageListView.QueuedBackgroundWorker

Inheritance: System.ComponentModel.Component
Show file Open project: d2phap/ImageGlass Class Usage Examples

Private Properties

Property Type Description
AddWork void
BuildWorkQueue void
ClearWorkQueue void
ClearWorkQueue void
CreateThreads void
GetWork int>.Utility.Tuple
IsWorkQueueEmpty bool
Run void
RunWorkerCompletedCallback void

Public Methods

Method Description
CancelAsync ( ) : void

Cancels all pending operations in all queues.

CancelAsync ( int priority ) : void

Cancels all pending operations in the given queue.

CancelAsync ( object argument ) : void

Cancels processing the item with the given key.

GetApartmentState ( ) : ApartmentState

Gets the apartment state of worker threads.

Pause ( ) : void

Pauses the worker.

QueuedBackgroundWorker ( ) : System

Initializes a new instance of the QueuedBackgroundWorker class.

Resume ( ) : void

Resumes processing pending operations in the work queue.

RunWorkerAsync ( ) : void

Starts processing a new background operation.

RunWorkerAsync ( object argument ) : void

Starts processing a new background operation.

RunWorkerAsync ( object argument, int priority ) : void

Starts processing a new background operation.

RunWorkerAsync ( object argument, int priority, bool single ) : void

Starts processing a new background operation.

SetApartmentState ( ApartmentState state ) : void

Sets the apartment state of worker threads. The apartment state cannot be changed after any work is added to the work queue.

Protected Methods

Method Description
Dispose ( bool disposing ) : void

Releases the unmanaged resources used by the T:System.ComponentModel.Component and optionally releases the managed resources.

OnDoWork ( ImageGlass.ImageListView.QueuedWorkerDoWorkEventArgs e ) : void

Raises the DoWork event.

OnRunWorkerCompleted ( ImageGlass.ImageListView.QueuedWorkerCompletedEventArgs e ) : void

Raises the RunWorkerCompleted event.

Private Methods

Method Description
AddWork ( object argument, int priority, bool single ) : void

Adds the operation to the work queue. This method must be called from inside a lock.

BuildWorkQueue ( ) : void

Rebuilds the work queue. This method must be called from inside a lock.

ClearWorkQueue ( ) : void

Clears all work queues. This method must be called from inside a lock.

ClearWorkQueue ( int priority ) : void

Clears the work queue with the given priority. This method must be called from inside a lock.

CreateThreads ( ) : void

Creates the thread array.

GetWork ( ) : int>.Utility.Tuple

Gets a pending operation from the work queue. This method must be called from inside a lock.

IsWorkQueueEmpty ( ) : bool

Determines if the work queue is empty. This method must be called from inside a lock.

Run ( ) : void

Used by the worker thread to process items.

RunWorkerCompletedCallback ( object arg ) : void

Used to call OnRunWorkerCompleted by the synchronization context.

Method Details

CancelAsync() public method

Cancels all pending operations in all queues.
public CancelAsync ( ) : void
return void

CancelAsync() public method

Cancels all pending operations in the given queue.
public CancelAsync ( int priority ) : void
priority int A value between 0 and /// indicating the priority queue to cancel.
return void

CancelAsync() public method

Cancels processing the item with the given key.
public CancelAsync ( object argument ) : void
argument object The argument of an asynchronous operation.
return void

Dispose() protected method

Releases the unmanaged resources used by the T:System.ComponentModel.Component and optionally releases the managed resources.
protected Dispose ( bool disposing ) : void
disposing bool true to release both managed and unmanaged resources; /// false to release only unmanaged resources.
return void

GetApartmentState() public method

Gets the apartment state of worker threads.
public GetApartmentState ( ) : ApartmentState
return ApartmentState

OnDoWork() protected method

Raises the DoWork event.
protected OnDoWork ( ImageGlass.ImageListView.QueuedWorkerDoWorkEventArgs e ) : void
e ImageGlass.ImageListView.QueuedWorkerDoWorkEventArgs A that contains event data.
return void

OnRunWorkerCompleted() protected method

Raises the RunWorkerCompleted event.
protected OnRunWorkerCompleted ( ImageGlass.ImageListView.QueuedWorkerCompletedEventArgs e ) : void
e ImageGlass.ImageListView.QueuedWorkerCompletedEventArgs A that contains event data.
return void

Pause() public method

Pauses the worker.
public Pause ( ) : void
return void

QueuedBackgroundWorker() public method

Initializes a new instance of the QueuedBackgroundWorker class.
public QueuedBackgroundWorker ( ) : System
return System

Resume() public method

Resumes processing pending operations in the work queue.
public Resume ( ) : void
return void

RunWorkerAsync() public method

Starts processing a new background operation.
public RunWorkerAsync ( ) : void
return void

RunWorkerAsync() public method

Starts processing a new background operation.
public RunWorkerAsync ( object argument ) : void
argument object The argument of an asynchronous operation.
return void

RunWorkerAsync() public method

Starts processing a new background operation.
public RunWorkerAsync ( object argument, int priority ) : void
argument object The argument of an asynchronous operation.
priority int A value between 0 and indicating the priority of this item. /// An item with a higher priority will be processed before items with lower priority.
return void

RunWorkerAsync() public method

Starts processing a new background operation.
public RunWorkerAsync ( object argument, int priority, bool single ) : void
argument object The argument of an asynchronous operation.
priority int A value between 0 and indicating the priority of this item. /// An item with a higher priority will be processed before items with lower priority.
single bool true to run this operation without waiting for queued items; otherwise /// false to add this operatino to th queue.
return void

SetApartmentState() public method

Sets the apartment state of worker threads. The apartment state cannot be changed after any work is added to the work queue.
public SetApartmentState ( ApartmentState state ) : void
state ApartmentState The new state of worker threads.
return void