I added an event handler to the WebClient\'s DownloadProgressChanged
event, but it never seems to fire. The file successfully downloads, but without having its
client.DownloadFile(url, savepath);
You have to use the async version to download a file, currently you use the blocking, synchronous version.
From the msdn docs for WebClient.DownloadProgressChanged
:
Occurs when an asynchronous download operation successfully transfers some or all of the data.
In your case that would be:
client.DownloadProgressChanged += new DownloadProgressChangedEventHandler(client_DownloadProgressChanged);
client.DownloadFileAsync (url, savepath);
Since your method does not directly return any result, this refactoring shouldn't be a problem, note though that the download most likely has not been completed by the time the method returns to the caller.