DownloadProgressChangedEventArgs.BytesReceived 属性
定义
重要
一些信息与预发行产品相关,相应产品在发行之前可能会进行重大修改。 对于此处提供的信息,Microsoft 不作任何明示或暗示的担保。
获取收到的字节数。
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 属性。