Post by Deleted on May 31, 2015 23:15:53 GMT 10
Download Code: SampleProject.zipHere's a simple DownloadFileAsync class that allows resuming and also returns a few extra properties, like download speed, download time and remaining time. You can specify the update frequency (no delay, every 500ms or every second), so the ProgressChanged event doesn't fire continuously and hog CPU when updating controls. The added example also shows you how to create an ownerdrawn ListView, so you can draw a custom progressbar, in order to show the download progress. This version only supports Http downloads, because that's what most people use DownloadFileAsync for. The DownloadFileAsyncExtended, HttpWebRequestState, FileDownloadProgressChangedEventArgs and FileDownloadCompletedEventArgs classes have been added to a single file for convenience. You might want to put each class in its own file. I'm sure there are a few things that can be improved, so comments are welcome. I had to remove all executables from the project before posting it here. You might get a warning "Could not find type 'SampleProject.ListViewExtended'". In that case, Build the sample project first and restart the project. Enjoy!
|
|