Share via


DownloadProgressChangedEventArgs.TotalBytesToReceive Eigenschaft

Definition

Ruft die Gesamtzahl der Bytes ab, die bei einem Download von WebClient-Daten übertragen werden.

public:
 property long TotalBytesToReceive { long get(); };
public long TotalBytesToReceive { get; }
member this.TotalBytesToReceive : int64
Public ReadOnly Property TotalBytesToReceive As Long

Eigenschaftswert

Ein Int64-Wert, der die Anzahl von Bytes angibt, die empfangen werden.

Beispiele

Das folgende Codebeispiel zeigt eine Implementierung eines Handlers für das DownloadProgressChanged Ereignis. Die -Methode zeigt den Wert der TotalBytesToReceive -Eigenschaft an.

static void UploadProgressCallback(Object^ sender,
          UploadProgressChangedEventArgs^ e)
      {
          // Displays the operation identifier, and the transfer progress.
          Console::WriteLine("{0}    uploaded {1} of {2} bytes. {3} % complete...",
              (String ^)e->UserState,
              e->BytesSent,
              e->TotalBytesToSend,
              e->ProgressPercentage);
      }
static void DownloadProgressCallback(Object^ sender,
          DownloadProgressChangedEventArgs^ e)
      {
          // Displays the operation identifier, and the transfer progress.
          Console::WriteLine("{0}    downloaded {1} of {2} bytes. {3} % complete...",
              (String ^)e->UserState,
              e->BytesReceived,
              e->TotalBytesToReceive,
              e->ProgressPercentage);
      }
private static void UploadProgressCallback(object sender, UploadProgressChangedEventArgs e)
{
    // Displays the operation identifier, and the transfer progress.
    Console.WriteLine("{0}    uploaded {1} of {2} bytes. {3} % complete...",
        (string)e.UserState,
        e.BytesSent,
        e.TotalBytesToSend,
        e.ProgressPercentage);
}
private static void DownloadProgressCallback(object sender, DownloadProgressChangedEventArgs e)
{
    // Displays the operation identifier, and the transfer progress.
    Console.WriteLine("{0}    downloaded {1} of {2} bytes. {3} % complete...",
        (string)e.UserState,
        e.BytesReceived,
        e.TotalBytesToReceive,
        e.ProgressPercentage);
}
Private Shared Sub UploadProgressCallback(ByVal sender As Object, ByVal e As UploadProgressChangedEventArgs)

    '  Displays the operation identifier, and the transfer progress.
    Console.WriteLine("{0}    uploaded {1} of {2} bytes. {3} % complete...", _
     CStr(e.UserState), e.BytesSent, e.TotalBytesToSend, e.ProgressPercentage)
End Sub
Private Shared Sub DownloadProgressCallback(ByVal sender As Object, ByVal e As DownloadProgressChangedEventArgs)

    '  Displays the operation identifier, and the transfer progress.
    Console.WriteLine("{0}    downloaded {1} of {2} bytes. {3} % complete...", _
     CStr(e.UserState), e.BytesReceived, e.TotalBytesToReceive, e.ProgressPercentage)
End Sub

Hinweise

Verwenden Sie die -Eigenschaft, um die BytesReceived Anzahl der bereits empfangenen Bytes zu bestimmen.

Verwenden Sie die ProgressPercentage -Eigenschaft, um zu bestimmen, welcher Prozentsatz der Übertragung stattgefunden hat.

Gilt für: