要下載一些我做DownloadDataAsync圖像的調用來分開Web客戶端的情況下,在一個循環中,有一個線程睡眠延遲。我期望響應發生在單獨的線程上,但似乎沒有,因爲響應只發生在所有調用完成後。如何從WebClient DownloadDataAsync(或其他)獲取多線程響應?
那麼,什麼是這個的appropritate解決?是否有替代的客戶端類型,或者我應該爲每個Web客戶端調用創建一個線程?
所以目前我在一個循環中調用此:
Private Sub StartDownload(ByVal webImageLink As String, ByVal token As Object)
Dim wc As New WebClient
Try
AddHandler wc.DownloadDataCompleted, AddressOf OnDownloadCompleted
wc.DownloadDataAsync(New System.Uri(webImageLink), token)
Threading.Thread.Sleep(delay)
Catch ex As Exception
Debug.Print("Exception in ImageDownloader.DoDownload ")
End Try
End Sub
你可以張貼一些代碼? – Strillo 2012-03-27 12:10:24
@Strillo,做,我認爲這是所有的相關的.. – bretddog 2012-03-27 12:15:25