Sub ProcessNextTask
If TaskCount > 0 Then
TaskCount = TaskCount - 1
req = CreateHttpRequest(FileDownloadLink)
ExecuteRequest(req)
End If
End Sub
Sub ExecuteRequest(req as HttpRequest)
If File.ExternalWritable = False then
'Abort Download but process Next Task
ProcessNextTask
Else
HttpClient1.Execute(req, taskid)
End If
End Sub
Sub hc_ResponseSuccess (Response As HttpResponse, TaskId As Int)
Response.GetAsynchronously("response", File.OpenOutput(TempFolder, TaskId, False), _
True, TaskId)
End Sub
Sub Response_StreamFinish (Success As Boolean, TaskId As Int)
ProcessNextTask
End Sub
Sub hc_ResponseError (Response As HttpResponse, Reason As String, StatusCode As Int, TaskId As Int)
ProcessNextTask
End Sub