我正在使用 Windows Phone 通过 WebClient 下载文件。DownloadProgressChanged 事件不起作用。它只触发一次,为 DownloadProgressChangedEventArgs.BytesRecieved 返回值“4923206”。我的代码是:
private void listBox1_SelectionChanged(object sender, SelectionChangedEventArgs e)
{
WebClient wb = new WebClient();
wb.DownloadProgressChanged += wbchange;
wb.OpenReadAsync(new Uri("http://sohowww.nascom.nasa.gov/data/LATEST/current_eit_304small.gif"));
}
private void wbchange(object sender, DownloadProgressChangedEventArgs e)
{
MessageBox.Show(e.BytesReceived.ToString()); (obviously in the end I will not be showing a message at every change)
}
这有什么问题?