Export (0) Print
Expand All

BackgroundWorker.IsBusy Property

Gets a value that indicates whether the BackgroundWorker is running a background operation.

Namespace:  System.ComponentModel
Assembly:  System (in System.dll)

public bool IsBusy { get; }

Property Value

Type: System.Boolean
true, if the BackgroundWorker is running a background operation; otherwise, false.

The BackgroundWorker starts a background operation when you call the RunWorkerAsync method. If the background worker's IsBusy property is true, calling RunWorkerAsync again will raise an InvalidOperationException.

The following code example demonstrates the use of the IsBusy property to check whether a background operation is already running before starting it. To view the complete code for this sample, see How to: Use a Background Worker.


private void buttonStart_Click(object sender, RoutedEventArgs e)
{
    if (bw.IsBusy != true)
    {
        bw.RunWorkerAsync();
    }
}


Silverlight

Supported in: 5, 4, 3

Silverlight for Windows Phone

Supported in: Windows Phone OS 7.1, Windows Phone OS 7.0

XNA Framework

Supported in: Xbox 360, Windows Phone OS 7.0

For a list of the operating systems and browsers that are supported by Silverlight, see Supported Operating Systems and Browsers.

Community Additions

ADD
Show:
© 2014 Microsoft