Show / Hide Table of Contents

Class BackgroundWorker

Implements a simple worker to do work in the background. Calls the backgroundworker events 'DoWork' and 'RunWorkerCompleted'. Does not support cancellation. Sets the Parameter property of the WorkerResult which is the parameter of the response method to the RunWorkerCompletedEventArgs. Sets the Exception property of the WorkerResult which is the parameter of the response method to the RunWorkerCompletedEventArgs.Error so that the developer can handle the exception in the response method.

Inheritance
System.Object
BackgroundWorker
Implements
IBackgroundWorker
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: Sartorius.SAF.Threading
Assembly: Sartorius.SAF.dll
Syntax
[Export(typeof(IBackgroundWorker))]
public class BackgroundWorker : IBackgroundWorker

Methods

View Source

DoWork(Action, Action<WorkerResult>)

Does the given work in the background. When the work is done, the response is invoked, if exists.

Declaration
public void DoWork(Action work, Action<WorkerResult> response)
Parameters
Type Name Description
System.Action work

The work to be done.

System.Action<WorkerResult> response

The response action that is invoked when the work is done.

View Source

DoWork<T>(Func<T>, Action<WorkerResult<T>>)

Does the given work in the background. When the work is done, the response is invoked.

Declaration
public void DoWork<T>(Func<T> work, Action<WorkerResult<T>> response)
Parameters
Type Name Description
System.Func<T> work

The work to be done. The result value of work is set to Result parameter of WorkerResult which is input of response.

System.Action<WorkerResult<T>> response

The response action that is invoked when the work is done. The result value of work is set to Result parameter of WorkerResult which is input of response.

Type Parameters
Name Description
T

Implements

IBackgroundWorker

Extension Methods

CollectionExtensions.AddRange<T, TCollection>(TCollection, IEnumerable<T>)
SerializableObjectCloneExtension.Clone<T>(T)
  • View Source
Back to top Generated by DocFX