/// <summary> /// OnDownloadDataCompleted is the default WebClient function that is called after data has been downloaded. /// </summary> /// <param name="args"></param> protected override void OnDownloadDataCompleted(DownloadDataCompletedEventArgs args) { count++; // Call the base function base.OnDownloadDataCompleted(args); // Dequeue current download request and use its callback DownloadRequest Req; lock (_Padlock) { Req = DownloadRequests.Dequeue(); } try { Req.Callback(args.Result); } catch (Exception e) { Console.WriteLine(e.Message + " " + e.StackTrace); Console.WriteLine("Insert Custom Error Message / Error code for handling HTTP 404"); netmanager.CallDataError(Req.Url); StartNextDownload(); return; } Console.WriteLine("Completed byte download, passed to callback function."); //DataTracker.updateJob(Req.Url, DataTracker.Status.FINISHED); // Need some way of notifying that this download is finished --- errors,success netmanager.CallDownloadComplete(Req.Url); // Start the next one StartNextDownload(); }