DoWorkEventArgs DoWorkEventArgs DoWorkEventArgs DoWorkEventArgs Class

정의

DoWork 이벤트 처리기에 대한 데이터를 제공합니다.Provides data for the DoWork event handler.

public ref class DoWorkEventArgs : System::ComponentModel::CancelEventArgs
public class DoWorkEventArgs : System.ComponentModel.CancelEventArgs
type DoWorkEventArgs = class
    inherit CancelEventArgs
Public Class DoWorkEventArgs
Inherits CancelEventArgs
상속

예제

다음 코드 예제를 사용 하는 방법에 설명 합니다 DoWorkEventArgs 처리 하는 클래스를 DoWork 이벤트입니다.The following code example demonstrates how to use the DoWorkEventArgs class to handle the DoWork event. 전체 코드 목록을 참조 하세요. 방법: 백그라운드에서 작업 실행을 참조하세요.For a full code listing, see How to: Run an Operation in the Background.

private void backgroundWorker1_DoWork(object sender, DoWorkEventArgs e)
{
    // Do not access the form's BackgroundWorker reference directly.
    // Instead, use the reference provided by the sender parameter.
    BackgroundWorker bw = sender as BackgroundWorker;

    // Extract the argument.
    int arg = (int)e.Argument;

    // Start the time-consuming operation.
    e.Result = TimeConsumingOperation(bw, arg);

    // If the operation was canceled by the user, 
    // set the DoWorkEventArgs.Cancel property to true.
    if (bw.CancellationPending)
    {
        e.Cancel = true;
    }
}
Private Sub backgroundWorker1_DoWork( _
sender As Object, e As DoWorkEventArgs) _
Handles backgroundWorker1.DoWork

   ' Do not access the form's BackgroundWorker reference directly.
   ' Instead, use the reference provided by the sender parameter.
   Dim bw As BackgroundWorker = CType( sender, BackgroundWorker )
   
   ' Extract the argument.
   Dim arg As Integer = Fix(e.Argument)
   
   ' Start the time-consuming operation.
   e.Result = TimeConsumingOperation(bw, arg)
   
   ' If the operation was canceled by the user, 
   ' set the DoWorkEventArgs.Cancel property to true.
   If bw.CancellationPending Then
      e.Cancel = True
   End If

End Sub   

생성자

DoWorkEventArgs(Object) DoWorkEventArgs(Object) DoWorkEventArgs(Object) DoWorkEventArgs(Object)

DoWorkEventArgs 클래스의 새 인스턴스를 초기화합니다.Initializes a new instance of the DoWorkEventArgs class.

속성

Argument Argument Argument Argument

비동기 작업의 인수를 나타내는 값을 가져옵니다.Gets a value that represents the argument of an asynchronous operation.

Cancel Cancel Cancel Cancel
Result Result Result Result

비동기 작업의 결과를 나타내는 값을 가져오거나 설정합니다.Gets or sets a value that represents the result of an asynchronous operation.

메서드

Equals(Object) Equals(Object) Equals(Object) Equals(Object)

지정한 개체와 현재 개체가 같은지 여부를 확인합니다.Determines whether the specified object is equal to the current object.

(Inherited from Object)
GetHashCode() GetHashCode() GetHashCode() GetHashCode()

기본 해시 함수로 작동합니다.Serves as the default hash function.

(Inherited from Object)
GetType() GetType() GetType() GetType()

현재 인스턴스의 Type을 가져옵니다.Gets the Type of the current instance.

(Inherited from Object)
MemberwiseClone() MemberwiseClone() MemberwiseClone() MemberwiseClone()

현재 Object의 단순 복사본을 만듭니다.Creates a shallow copy of the current Object.

(Inherited from Object)
ToString() ToString() ToString() ToString()

현재 개체를 나타내는 문자열을 반환합니다.Returns a string that represents the current object.

(Inherited from Object)

적용 대상

추가 정보