UploadDataCompletedEventArgs UploadDataCompletedEventArgs UploadDataCompletedEventArgs UploadDataCompletedEventArgs Class

Definition

Stellt Daten für das UploadDataCompleted-Ereignis bereit.Provides data for the UploadDataCompleted event.

public ref class UploadDataCompletedEventArgs : System::ComponentModel::AsyncCompletedEventArgs
public class UploadDataCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs
type UploadDataCompletedEventArgs = class
    inherit AsyncCompletedEventArgs
Public Class UploadDataCompletedEventArgs
Inherits AsyncCompletedEventArgs
Vererbung
UploadDataCompletedEventArgsUploadDataCompletedEventArgsUploadDataCompletedEventArgsUploadDataCompletedEventArgs

Beispiele

Im folgenden Codebeispiel wird veranschaulicht, asynchron Hochladen von Daten.The following code example demonstrates asynchronously uploading data.

void UploadDataInBackground2( String^ address )
{
   WebClient^ client = gcnew WebClient;
   Uri ^uri = gcnew Uri(address);
   String^ text = "Time = 12:00am temperature = 50";
   array<Byte>^data = System::Text::Encoding::UTF8->GetBytes( text );
   String^ method = "POST";

   client->UploadDataCompleted += gcnew UploadDataCompletedEventHandler( UploadDataCallback2 );
   client->UploadDataAsync( uri, method, data );
}


public static void UploadDataInBackground2 (string address)
{
    WebClient client = new WebClient ();
    Uri uri = new Uri(address);
    string text = "Time = 12:00am temperature = 50";
    byte[] data = System.Text.Encoding.UTF8.GetBytes (text);
    string method = "POST";

    client.UploadDataCompleted += new UploadDataCompletedEventHandler (UploadDataCallback2);
    client.UploadDataAsync (uri, method, data);
}

Public Shared Sub UploadDataInBackground2(ByVal address As String)

	Dim client As WebClient = New WebClient()
	Dim text As String = "Time = 12:00am temperature = 50"
	Dim data() As Byte = System.Text.Encoding.UTF8.GetBytes(text)
	Dim method As String = "POST"

	AddHandler client.UploadDataCompleted, AddressOf UploadDataCallback2
	Dim uri as Uri = New Uri(address)
                      client.UploadDataAsync(uri, method, data)
End Sub

Die folgende Methode wird aufgerufen, wenn der Upload abgeschlossen ist.The following method is called when the upload completes.

void UploadDataCallback2( Object^ /*sender*/, UploadDataCompletedEventArgs^ e )
{
   array<Byte>^data = dynamic_cast<array<Byte>^>(e->Result);
   String^ reply = System::Text::Encoding::UTF8->GetString( data );
   Console::WriteLine( reply );
}


private static void UploadDataCallback2 (Object sender, UploadDataCompletedEventArgs e)
{
    byte[] data = (byte[])e.Result;
    string reply = System.Text.Encoding.UTF8.GetString (data);

    Console.WriteLine (reply);
}

Private Shared Sub UploadDataCallback2(ByVal sender As Object, ByVal e As UploadDataCompletedEventArgs)

    Dim data() As Byte = CType(e.Result, Byte())
    Dim reply As String = System.Text.Encoding.UTF8.GetString(data)

    Console.WriteLine(reply)
End Sub

Hinweise

Instanzen dieser Klasse werden zum Übergeben der UploadDataCompletedEventHandler.Instances of this class are passed to the UploadDataCompletedEventHandler.

Eigenschaften

Cancelled Cancelled Cancelled Cancelled

Ruft einen Wert ab, der angibt, ob ein asynchroner Vorgang abgebrochen wurde.Gets a value indicating whether an asynchronous operation has been canceled.

(Inherited from AsyncCompletedEventArgs)
Error Error Error Error

Ruft einen Wert ab, der angibt, welcher Fehler während eines asynchronen Vorgangs aufgetreten ist.Gets a value indicating which error occurred during an asynchronous operation.

(Inherited from AsyncCompletedEventArgs)
Result Result Result Result

Ruft die Serverantwort an einen Datenuploadvorgang ab, der durch den Aufruf einer UploadDataAsync-Methode gestartet wurde.Gets the server reply to a data upload operation started by calling an UploadDataAsync method.

UserState UserState UserState UserState

Ruft den eindeutigen Bezeichner der asynchronen Aufgabe ab.Gets the unique identifier for the asynchronous task.

(Inherited from AsyncCompletedEventArgs)

Methoden

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

Bestimmt, ob das angegebene Objekt mit dem aktuellen Objekt identisch ist.Determines whether the specified object is equal to the current object.

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

Fungiert als Standardhashfunktion.Serves as the default hash function.

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

Ruft den Type der aktuellen Instanz ab.Gets the Type of the current instance.

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

Erstellt eine flache Kopie des aktuellen Object.Creates a shallow copy of the current Object.

(Inherited from Object)
RaiseExceptionIfNecessary() RaiseExceptionIfNecessary() RaiseExceptionIfNecessary() RaiseExceptionIfNecessary()

Löst eine benutzerdefinierte Ausnahme aus, wenn bei einem asynchronen Vorgang ein Fehler aufgetreten ist.Raises a user-supplied exception if an asynchronous operation failed.

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

Gibt eine Zeichenfolge zurück, die das aktuelle Objekt darstellt.Returns a string that represents the current object.

(Inherited from Object)

Gilt für: