According to
http://msdn.microsoft.com/en-us/library/system.net.webclient.downloadprogresschanged.aspx,
OpenFileAsync should have DownloadProgressChanged firing whenever it makes progress.
I can't get it to fire at all. Fires fine with DownloadDataAsync and DownloadFileAsync instead though.
Here's a simple example:
using System;
using System.Net;
namespace ConsoleApplication1
{
class Program
{
static void Main(string[] args)
{
WebClient client = new WebClient();
client.OpenReadCompleted += new OpenReadCompletedEventHandler(client_OpenReadCompleted);
client.DownloadProgressChanged += new DownloadProgressChangedEventHandler(client_DownloadProgressChanged);
client.OpenReadAsync(new Uri("http://www.stackoverflow.com"));
Console.ReadKey();
}
static void client_DownloadProgressChanged(object sender, DownloadProgressChangedEventArgs e)
{
Console.WriteLine("{0}% Downloaded", e.ProgressPercentage);
}
static void client_OpenReadCompleted(object sender, OpenReadCompletedEventArgs e)
{
Console.WriteLine("Open Read Completed");
}
}
}
For me the DownloadProgressChanged event never fires, although change to DownloadFileAsync or DownloadDataAsync and it does.