hvordan kan jeg få mit program til at download 1 fil af gangen? VB.net
hej er i gang med at lave en download manager med software som jeg selv laver i vb.net men hvis jeg har 3 downloads så downloader de samtidigt hvordan kan man få dem til at downloade 1 af gangen? når det er checkboxes. fx hvis der er 3 chekboxes og jeg vælger 2 checkboxes så for jeg 2 downloads med det valgte software som jeg har lavet hvordan hvis jeg vælger 3 checkboxes hvordan får jeg den til at download 1 af gangen?code:
Imports System.Net
Public Class Form1
Private WithEvents wc1 As New Net.WebClient
Private WithEvents wc2 As New Net.WebClient
Private WithEvents wc3 As New Net.WebClient
Private q As New Queue
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Dim SFD As New SaveFileDialog
If SFD.ShowDialog() = DialogResult.OK Then
wc1.DownloadFileAsync(New Uri("https://dl.dropboxusercontent.com/u/185853590/client/update/minecraft.jar"), SFD.FileName)
End If
End Sub
Private Sub wc1_DownloadFileCompleted(sender As Object, e As System.ComponentModel.AsyncCompletedEventArgs) Handles wc1.DownloadFileCompleted
MsgBox("Done")
ProgressBar1.Value = 0
End Sub
Private Sub wc1_DownloadProgressChanged(sender As Object, e As DownloadProgressChangedEventArgs) Handles wc1.DownloadProgressChanged
ProgressBar1.Maximum = e.TotalBytesToReceive
ProgressBar1.Value = e.BytesReceived
End Sub
Private Sub Button2_Click(sender As Object, e As EventArgs) Handles Button2.Click
Dim SFD As New SaveFileDialog
If SFD.ShowDialog() = DialogResult.OK Then
wc2.DownloadFileAsync(New Uri("https://dl.dropboxusercontent.com/u/185853590/client/update/minecraft.jar"), SFD.FileName)
End If
End Sub
Private Sub wc2_DownloadFileCompleted(sender As Object, e As System.ComponentModel.AsyncCompletedEventArgs) Handles wc2.DownloadFileCompleted
MsgBox("Done")
ProgressBar1.Value = 0
End Sub
Private Sub wc2_DownloadProgressChanged(sender As Object, e As DownloadProgressChangedEventArgs) Handles wc2.DownloadProgressChanged
ProgressBar1.Maximum = e.TotalBytesToReceive
ProgressBar1.Value = e.BytesReceived
End Sub
Private Sub Button3_Click(sender As Object, e As EventArgs) Handles Button3.Click
If CheckBox1.Checked = True Then
Dim SFD As New SaveFileDialog
If SFD.ShowDialog() = DialogResult.OK Then
wc1.DownloadFileAsync(New Uri("https://dl.dropboxusercontent.com/u/185853590/client/update/minecraft.jar"), SFD.FileName)
End If
End If
If CheckBox2.Checked = True Then
Dim SFD As New SaveFileDialog
If SFD.ShowDialog() = DialogResult.OK Then
wc2.DownloadFileAsync(New Uri("https://dl.dropboxusercontent.com/u/185853590/client/update/minecraft.jar"), SFD.FileName)
End If
End If
If CheckBox3.Checked = True Then
Dim SFD As New SaveFileDialog
If SFD.ShowDialog() = DialogResult.OK Then
wc3.DownloadFileAsync(New Uri("https://dl.dropboxusercontent.com/u/185853590/client/update/minecraft.jar"), SFD.FileName)
End If
End If
End Sub
Private Sub wc3_DownloadFileCompleted(sender As Object, e As System.ComponentModel.AsyncCompletedEventArgs) Handles wc3.DownloadFileCompleted
MsgBox("Done")
ProgressBar1.Value = 0
End Sub
Private Sub wc3_DownloadProgressChanged(sender As Object, e As DownloadProgressChangedEventArgs) Handles wc3.DownloadProgressChanged
ProgressBar1.Maximum = e.TotalBytesToReceive
ProgressBar1.Value = e.BytesReceived
End Sub
End Class