我正在制作一个自动文件下载器,当我按下按钮时,我需要它重新下载并覆盖文件,但我不希望它在下载时挂起。我不知道如何为此代码实现 DownloadFileAsync。请帮忙!
这是我的代码:
Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
Button1.Enabled = False
Button1.Text = "Updating..."
WebBrowser1.Visible = True
My.Computer.Network.DownloadFile _
(address:="http://199.91.154.170/e9f6poiwfocg/pei02c8727sa720/Ultra+v08.zip", _
destinationFileName:=Path.Combine(Environment.GetFolderPath( _
Environment.SpecialFolder.ApplicationData), _
"test/Test.zip"), _
userName:=String.Empty, password:=String.Empty, _
showUI:=False, connectionTimeout:=100000, _
overwrite:=True)
WebBrowser1.Visible = False
Button1.Text = "Updated!"
PictureBox1.Visible = True
End Sub
提前致谢!