public void Pause()
{
// Only downloading downloader can be paused.
if (this.Status != DownloadStatus.Downloading)
{
throw new ApplicationException(
"Only downloading downloader can be paused.");
}
this.Status = DownloadStatus.Pausing;
// Pause all the HttpDownloadClients. If all of the clients are paused,
// the status of the downloader will be changed to Paused.
foreach (var client in this.downloadClients)
{
if (client.Status == DownloadStatus.Downloading)
{
client.Pause();
}
}
}