Show / Hide Table of Contents

Class SoBackgroundWorker

Inheritance
Object
SoBackgroundWorker
BulkUpdateSystem.BackgroundJob
Namespace: SuperOffice.Threading
Assembly: SoCore.dll
Syntax
public class SoBackgroundWorker : Component

Constructors

SoBackgroundWorker()

Initializes a new instance of the SuperOffice.Threading.SoBackgroundWorker class.

Declaration
public SoBackgroundWorker()

Properties

CancellationPending

Gets a value indicating whether the application has requested cancellation of a background operation.

Declaration
public bool CancellationPending { get; }
Property Value
Type Description
Boolean

true if the application has requested cancellation of a background operation; otherwise, false. The default is false.

IsBusy

Gets a value indicating whether the SuperOffice.Threading.SoBackgroundWorker is running an asynchronous operation.

Declaration
public bool IsBusy { get; }
Property Value
Type Description
Boolean

true, if the SuperOffice.Threading.SoBackgroundWorker is running an asynchronous operation; otherwise, false.

WorkerReportsProgress

Gets or sets a value indicating whether the SuperOffice.Threading.SoBackgroundWorker can report progress updates.

Declaration
public bool WorkerReportsProgress { get; set; }
Property Value
Type Description
Boolean

true if the SuperOffice.Threading.SoBackgroundWorker supports progress updates; otherwise false. The default is false.

WorkerSupportsCancellation

Gets or sets a value indicating whether the SuperOffice.Threading.SoBackgroundWorker supports asynchronous cancellation.

Declaration
public bool WorkerSupportsCancellation { get; set; }
Property Value
Type Description
Boolean

true if the SuperOffice.Threading.SoBackgroundWorker supports cancellation; otherwise false. The default is false.

Methods

CancelAsync()

Requests cancellation of a pending background operation.

Declaration
public void CancelAsync()
Exceptions
Type Condition
InvalidOperationException

SoBackgroundWorker.WorkerSupportsCancellation is false.

Dispose(Boolean)

Disposes resources...

Declaration
protected override void Dispose(bool disposing)
Parameters
Type Name Description
Boolean disposing

OnDoWork(DoWorkEventArgs)

Raises the SoBackgroundWorker.DoWork event.

Declaration
protected virtual void OnDoWork(DoWorkEventArgs e)
Parameters
Type Name Description
DoWorkEventArgs e

An System.EventArgs that contains the event data.

OnProgressChanged(ProgressChangedEventArgs)

Raises the SoBackgroundWorker.ProgressChanged event.

Declaration
protected virtual void OnProgressChanged(ProgressChangedEventArgs e)
Parameters
Type Name Description
ProgressChangedEventArgs e

An System.EventArgs that contains the event data.

OnRunWorkerCompleted(RunWorkerCompletedEventArgs)

Raises the SoBackgroundWorker.RunWorkerCompleted event.

Declaration
protected virtual void OnRunWorkerCompleted(RunWorkerCompletedEventArgs e)
Parameters
Type Name Description
RunWorkerCompletedEventArgs e

An System.EventArgs that contains the event data.

ReportProgress(Int32)

Raises the System.ComponentModel.BackgroundWorker.ProgressChanged event.

Declaration
public void ReportProgress(int percentProgress)
Parameters
Type Name Description
Int32 percentProgress

The percentage, from 0 to 100, of the background operation that is complete.

Exceptions
Type Condition
InvalidOperationException

The System.ComponentModel.BackgroundWorker.WorkerReportsProgress property is set to false.

ReportProgress(Int32, Object)

Raises the System.ComponentModel.BackgroundWorker.ProgressChanged event.

Declaration
public void ReportProgress(int percentProgress, object userState)
Parameters
Type Name Description
Int32 percentProgress

The percentage, from 0 to 100, of the background operation that is complete.

Object userState

The state object passed to SoBackgroundWorker.RunWorkerAsync(System.Object).

Exceptions
Type Condition
InvalidOperationException

The SoBackgroundWorker.WorkerReportsProgress property is set to false.

RunWorker(Boolean)

Starts execution of a background operation.

Declaration
public void RunWorker(bool async)
Parameters
Type Name Description
Boolean async
Exceptions
Type Condition
InvalidOperationException

SoBackgroundWorker.IsBusy is true.

RunWorkerAsync()

Starts execution of a background operation.

Declaration
public void RunWorkerAsync()
Exceptions
Type Condition
InvalidOperationException

SoBackgroundWorker.IsBusy is true.

RunWorkerAsync(Object)

Starts execution of a background operation.

Declaration
public void RunWorkerAsync(object argument)
Parameters
Type Name Description
Object argument

A parameter for use by the background operation to be executed in the SoBackgroundWorker.DoWork event handler.

Exceptions
Type Condition
InvalidOperationException

SoBackgroundWorker.IsBusy is true.

Events

DoWork

Occurs when System.ComponentModel.BackgroundWorker.RunWorkerAsync is called.

Declaration
public event DoWorkEventHandler DoWork
Event Type
Type Description
DoWorkEventHandler

ProgressChanged

Occurs when System.ComponentModel.BackgroundWorker.ReportProgress(System.Int32) is called.

Declaration
public event ProgressChangedEventHandler ProgressChanged
Event Type
Type Description
ProgressChangedEventHandler

RunWorkerCompleted

Occurs when the background operation has completed, has been canceled, or has raised an exception.

Declaration
public event RunWorkerCompletedEventHandler RunWorkerCompleted
Event Type
Type Description
RunWorkerCompletedEventHandler

Extension Methods

EnumUtil.MapEnums<From, To>(From)
ObjectExtensions.AssignByReflection<T>(T, T)
ObjectExtensions.GraphCopy<T>(T)
Converters.MapEnums<From, To>(From)
© SuperOffice. All rights reserved.
SuperOffice |  Community |  Release Notes |  Privacy |  Site feedback |  Search Docs |  About Docs |  Contribute |  Back to top