for (int i = 0; i < urls.Count; i++)
{
tracker.NewFile();
if (urls[i].Contains("Radar"))
{
lblStatus.Text = "Downloading Radar Images";
downloadedImageName = radarFolderImagesDownload + "\\radarImage" + radCounter + ".gif";
radCounter++;
try
{
await client.DownloadFileTaskAsync(new Uri(urls[i]), radarFolderImagesDownload + "\\radarImage" + radCounter + ".gif");
}
catch (WebException ex)
{
Logger.Write($"Downloading {urls[i]} failed. {ex.Message}");
}
catch (InvalidOperationException)
{
Logger.Write($"Saving {urls[i]} to {radarFolderImagesDownload + "\\radarImage" + radCounter + ".gif"} failed. File is in use.");
}
}
i used a break point and first it's getting to the line with the DownloadFileTaskAsync and then it's getting to the catch.
i want that if it's getting to the catch don't download and save empty image just continue to the next link in the urls list.