Bagikan melalui


UploadStringCompletedEventArgs Kelas

Definisi

Menyediakan data untuk peristiwa tersebut UploadStringCompleted .

public ref class UploadStringCompletedEventArgs : System::ComponentModel::AsyncCompletedEventArgs
public class UploadStringCompletedEventArgs : System.ComponentModel.AsyncCompletedEventArgs
type UploadStringCompletedEventArgs = class
    inherit AsyncCompletedEventArgs
Public Class UploadStringCompletedEventArgs
Inherits AsyncCompletedEventArgs
Warisan
UploadStringCompletedEventArgs

Contoh

Contoh kode berikut menunjukkan pengunggahan string secara asinkron.

void UploadStringInBackground2( String^ address )
{
   WebClient^ client = gcnew WebClient;
   Uri ^uri = gcnew Uri(address);
   String^ data = "Time = 12:00am temperature = 50";

   client->UploadStringCompleted += gcnew UploadStringCompletedEventHandler( UploadStringCallback2 );
   client->UploadStringAsync( uri, data );
}
public static void UploadStringInBackground2(string address)
{
    WebClient client = new WebClient();
    Uri uri = new Uri(address);
    string data = "Time = 12:00am temperature = 50";
    client.UploadStringCompleted += new UploadStringCompletedEventHandler(UploadStringCallback2);
    client.UploadStringAsync(uri, data);
}
Public Shared Sub UploadStringInBackground2(ByVal address As String)

    Dim client As WebClient = New WebClient()
    Dim data As String = "Time = 12:00am temperature = 50"
    AddHandler client.UploadStringCompleted, AddressOf UploadStringCallback2
                Dim uri as Uri = New Uri(address)
    client.UploadStringAsync(uri, data)
End Sub

Metode berikut dipanggil ketika unggahan selesai.

void UploadStringCallback2( Object^ /*sender*/, UploadStringCompletedEventArgs^ e )
{
   String^ reply = dynamic_cast<String^>(e->Result);
   Console::WriteLine( reply );
}
private static void UploadStringCallback2(Object sender, UploadStringCompletedEventArgs e)
{
    string reply = (string)e.Result;
    Console.WriteLine(reply);
}
Private Shared Sub UploadStringCallback2(ByVal sender As Object, ByVal e As UploadStringCompletedEventArgs)
    Dim reply As String = CStr(e.Result)
    Console.WriteLine(reply)
End Sub

Keterangan

Instans kelas ini diteruskan ke UploadStringCompletedEventHandler.

Properti

Cancelled

Mendapatkan nilai yang menunjukkan apakah operasi asinkron telah dibatalkan.

(Diperoleh dari AsyncCompletedEventArgs)
Error

Mendapatkan nilai yang menunjukkan kesalahan mana yang terjadi selama operasi asinkron.

(Diperoleh dari AsyncCompletedEventArgs)
Result

Mendapatkan balasan server ke operasi pengunggahan string yang dimulai dengan memanggil UploadStringAsync metode .

UserState

Mendapatkan pengidentifikasi unik untuk tugas asinkron.

(Diperoleh dari AsyncCompletedEventArgs)

Metode

Equals(Object)

Menentukan apakah objek yang ditentukan sama dengan objek saat ini.

(Diperoleh dari Object)
GetHashCode()

Berfungsi sebagai fungsi hash default.

(Diperoleh dari Object)
GetType()

Mendapatkan instans Type saat ini.

(Diperoleh dari Object)
MemberwiseClone()

Membuat salinan dangkal dari yang saat ini Object.

(Diperoleh dari Object)
RaiseExceptionIfNecessary()

Meningkatkan pengecualian yang disediakan pengguna jika operasi asinkron gagal.

(Diperoleh dari AsyncCompletedEventArgs)
ToString()

Mengembalikan string yang mewakili objek saat ini.

(Diperoleh dari Object)

Berlaku untuk