OpenWriteCompletedEventArgs OpenWriteCompletedEventArgs OpenWriteCompletedEventArgs OpenWriteCompletedEventArgs Class

정의

OpenWriteCompleted 이벤트에 대한 데이터를 제공합니다.Provides data for the OpenWriteCompleted event.

public ref class OpenWriteCompletedEventArgs : System::ComponentModel::AsyncCompletedEventArgs
public class OpenWriteCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs
type OpenWriteCompletedEventArgs = class
    inherit AsyncCompletedEventArgs
Public Class OpenWriteCompletedEventArgs
Inherits AsyncCompletedEventArgs
상속
OpenWriteCompletedEventArgsOpenWriteCompletedEventArgsOpenWriteCompletedEventArgsOpenWriteCompletedEventArgs

예제

다음 코드 예제 데이터 업로드를 쓸 스트림을 여는 방법을 보여 줍니다.The following code example demonstrates opening a stream to write data to be uploaded.

void OpenResourceForPosting( String^ address )
{
   WebClient^ client = gcnew WebClient;
   Uri ^uri = gcnew Uri(address);
   
   // Specify that the OpenWriteCallback method gets called
   // when the writeable stream is available.
   client->OpenWriteCompleted += gcnew OpenWriteCompletedEventHandler( OpenWriteCallback2 );
   client->OpenWriteAsync( uri );
   
   // Applications can perform other tasks
   // while waiting for the upload to complete.
}


public static void OpenResourceForPosting (string address)
{
    WebClient client = new WebClient ();
    Uri uri = new Uri(address);

    // Specify that the OpenWriteCallback method gets called
    // when the writeable stream is available.
    client.OpenWriteCompleted += new OpenWriteCompletedEventHandler (OpenWriteCallback2);
    client.OpenWriteAsync (uri);
    // Applications can perform other tasks
    // while waiting for the upload to complete.
}

Public Shared Sub OpenResourceForPosting(ByVal address As String)

    Dim client As WebClient = New WebClient()
    '  Specify that the OpenWriteCallback method gets called
    '  when the writeable stream is available.
    AddHandler client.OpenWriteCompleted, AddressOf OpenWriteCallback2
                Dim uri as Uri = New Uri(address)
    client.OpenWriteAsync(uri)
    '  Applications can perform other tasks
    '  while waiting for the upload to complete.
End Sub

다음 메서드는 스트림을 사용할 수 있는 경우 호출 됩니다.The following method is called when the stream is available.

void OpenWriteCallback2( Object^ /*sender*/, OpenWriteCompletedEventArgs^ e )
{
   Stream^ body = nullptr;
   StreamWriter^ s = nullptr;
   try
   {
      body = dynamic_cast<Stream^>(e->Result);
      s = gcnew StreamWriter( body );
      s->AutoFlush = true;
      s->Write( "This is content data to be sent to the server." );
   }
   finally
   {
      if ( s != nullptr )
      {
         s->Close();
      }
      if ( body != nullptr )
      {
         body->Close();
      }
   }

}


private static void OpenWriteCallback2 (Object sender, OpenWriteCompletedEventArgs e)
{
    Stream body = null;
    StreamWriter s = null;

    try
    {
        body = (Stream)e.Result;
        s = new StreamWriter (body);
        s.AutoFlush = true;
        s.Write ("This is content data to be sent to the server.");
    }
    finally
    {
        if (s != null)
        {
            s.Close ();
        }

        if (body != null)
        {
            body.Close ();
        }
    }
}

Private Shared Sub OpenWriteCallback2(ByVal sender As Object, ByVal e As OpenWriteCompletedEventArgs)

    Dim body As Stream = Nothing
    Dim s As StreamWriter = Nothing

    Try

        body = CType(e.Result, Stream)
        s = New StreamWriter(body)
        s.AutoFlush = True
        s.Write("This is content data to be sent to the server.")
    Finally

        If Not s Is Nothing Then

            s.Close()
        End If

        If Not body Is Nothing Then

            body.Close()
        End If
    End Try
End Sub

설명

이 클래스의 인스턴스를 전달할 OpenWriteCompletedEventHandler 메서드.Instances of this class are passed to OpenWriteCompletedEventHandler methods.

속성

Cancelled Cancelled Cancelled Cancelled

비동기 작업이 취소되었는지 여부를 나타내는 값을 가져옵니다.Gets a value indicating whether an asynchronous operation has been canceled.

(Inherited from AsyncCompletedEventArgs)
Error Error Error Error

비동기 작업 중 발생한 오류를 나타내는 값을 가져옵니다.Gets a value indicating which error occurred during an asynchronous operation.

(Inherited from AsyncCompletedEventArgs)
Result Result Result Result

서버에 데이터를 보내는 데 사용되는 쓰기 가능한 스트림을 가져옵니다.Gets a writable stream that is used to send data to a server.

UserState UserState UserState UserState

비동기 작업의 고유 식별자를 가져옵니다.Gets the unique identifier for the asynchronous task.

(Inherited from AsyncCompletedEventArgs)

메서드

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)
RaiseExceptionIfNecessary() RaiseExceptionIfNecessary() RaiseExceptionIfNecessary() RaiseExceptionIfNecessary()

비동기 작업에 실패한 경우 사용자가 제공한 예외를 발생시킵니다.Raises a user-supplied exception if an asynchronous operation failed.

(Inherited from AsyncCompletedEventArgs)
ToString() ToString() ToString() ToString()

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

(Inherited from Object)

적용 대상