DownloadProgressChangedEventArgs.BytesReceived Свойство
Определение
Важно!
Некоторые сведения относятся к предварительной версии продукта, в которую до выпуска могут быть внесены существенные изменения. Майкрософт не предоставляет никаких гарантий, явных или подразумеваемых, относительно приведенных здесь сведений.
Возвращает максимальное число полученных байтов.
public:
property long BytesReceived { long get(); };
public long BytesReceived { get; }
member this.BytesReceived : int64
Public ReadOnly Property BytesReceived As Long
Значение свойства
Значение Int64, которое указывает количество полученных байтов.
Примеры
В следующем примере кода показана реализация обработчика DownloadProgressChanged для события . Метод отображает значение BytesReceived
свойства .
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
Комментарии
Чтобы определить процент переноса, используйте ProgressPercentage свойство .