Results 1 to 19 of 19

Thread: WebClient DownloadFileAsync with resume support

Threaded View

  1. #1

    Thread Starter
    Frenzied Member
    Join Date
    Nov 2005
    Posts
    1,834

    WebClient DownloadFileAsync with resume support

    Here'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.
    Attached Images Attached Images  
    Attached Files Attached Files
    Last edited by Chris001; Jan 20th, 2012 at 12:34 AM.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width