0

I'm making a YouTube Downloader, I've finished everything [ The application is completed now ] but this annoys me ;

How to make something can pause this downloader

try
{
    wc = new WebClient();
    wc.DownloadProgressChanged += new DownloadProgressChangedEventHandler(wc_DownloadProgressChanged);
    wc.DownloadFileCompleted += new AsyncCompletedEventHandler(wc_DownloadFileCompleted);
    CancelBtn.Enabled = true;
    wc.DownloadFileAsync(new Uri(link), dwnFile);
    ResultLabel.Visible = false;
}
Grant Thomas
  • 44,454
  • 10
  • 85
  • 129
Alaa Alrifaie
  • 49
  • 1
  • 5
  • I don't think you can directly. You might need to do it manually somehow. – AD.Net Feb 26 '13 at 21:56
  • Are you looking for something like a restartable downloader, or do you just want to pause for a few seconds, keeping the connection open so you can un-pause and continue? – Jim Mischel Feb 26 '13 at 22:37

1 Answers1

2

You can't if you wish to continue using WebClient; otherwise you'll need to use a method that gives you more control over the streaming of bytes, such as a WebRequest (of which you can manage the response stream) or sockets.

Grant Thomas
  • 44,454
  • 10
  • 85
  • 129