DownloadProgressChangedEventArgs.BytesReceived Propiedad
Definición
Importante
Parte de la información hace referencia a la versión preliminar del producto, que puede haberse modificado sustancialmente antes de lanzar la versión definitiva. Microsoft no otorga ninguna garantía, explícita o implícita, con respecto a la información proporcionada aquí.
Obtiene el número de bytes recibidos.
public:
property long BytesReceived { long get(); };
public long BytesReceived { get; }
member this.BytesReceived : int64
Public ReadOnly Property BytesReceived As Long
Valor de propiedad
Un valor Int64 que indica el número de bytes recibidos.
Ejemplos
En el ejemplo de código siguiente se muestra una implementación de un controlador para el DownloadProgressChanged evento. El método muestra el valor de la BytesReceived
propiedad .
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
Comentarios
Para determinar qué porcentaje de la transferencia se ha producido, use la ProgressPercentage propiedad .