Raises the DoWork event to start execution of a worker thread operation, passing the specified argument to the worker thread.

Namespace:  ESRI.ArcGISExplorer.Threading

Assembly:  ESRI.ArcGISExplorer (in ESRI.ArcGISExplorer.dll) Version: 2.0.0.1500 (2.0.0.1500)

Syntax

C#
public void RunWorkerAsync(
	Object argument
)
Visual Basic (Declaration)
Public Sub RunWorkerAsync ( _
	argument As Object _
)

Parameters

argument
Type: System..::.Object

Information for use by the worker thread operation to be executed in the DoWork event handler.

Remarks

The RunWorkerAsync method should be called on the UI thread in order to begin a worker thread operation; it will raise the DoWork event on a worker thread. Make sure that an event handler is associated with the event before calling this method.

The RunWorkerAsync method is overloaded to allow passing optional argument information to the worker thread - this will be available from the Argument property.

Before calling RunWorkerAsync on a particular BackgroundWorker, you should use its IsBusy property - this indicates if the RunWorkerAsync method has already been called and the DoWork event has not yet exited. If the property is trueTruetruetrue (True in Visual Basic) you should not call RunWorkerAsync on this instance of the BackgroundWorker at this time. If a new worker thread operation is required, you can create a new instance of the BackgroundWorker class.

You must be careful not to manipulate any user-interface objects in your DoWork event handler. Instead, communicate to the user interface through the ProgressChanged and RunWorkerCompleted events.

Exceptions

ExceptionCondition
System..::.InvalidOperationExceptionIf the BackgroundWorker is already working, calling RunWorkerAsync again will raise an InvalidOperationException. Check the IsBusy property of the BackgroundWorker before calling RunWorkerAsync.

See Also