我的代码有问题。拿了一个表示某些文件名称的字符串数组,我会逐个下载它们添加到我的进度条中。当我运行时,代码文件被下载但GUI没有在标签内更新,也没有加载条。只有当程序退出循环时才运行外部代码。使用+4更新界面到栏。每次下载文件后如何更新条形码增加6?我哪里错了?下载冻结界面时更新
Private Sub patchButton_Click(sender As Object, e As EventArgs) Handles patchButton.Click
Dim fileDownload(15) As String
fileDownload(0) = "icon.eix"
fileDownload(1) = "icon.epk"
fileDownload(2) = "locale_tr.epk"
fileDownload(3) = "locale_tr.eix"
fileDownload(4) = "Metin2_patch_ZodiakMaps.eix"
fileDownload(5) = "Metin2_patch_ZodiakMaps.epk"
fileDownload(6) = "metin2_patch_ZodiakMonster.eix"
fileDownload(7) = "metin2_patch_ZodiakMonster.epk"
fileDownload(8) = "metin2_patch_ZodiarkArmor.eix"
fileDownload(9) = "metin2_patch_ZodiarkArmor.epk"
fileDownload(10) = "metin2_patch_ZodiarkEffect.eix"
fileDownload(11) = "metin2_patch_ZodiarkEffect.epk"
fileDownload(12) = "metin2_patch_ZodiarkWeapon.eix"
fileDownload(13) = "metin2_patch_ZodiarkWeapon.epk"
fileDownload(14) = "root.eix"
fileDownload(15) = "root.epk"
For Each item As String In fileDownload
consoleLabel.Text = "Update " + item + "..."
If My.Computer.FileSystem.FileExists(currentPath + "\pack\" + item) Then
My.Computer.FileSystem.DeleteFile(currentPath + "\pack\" + item)
My.Computer.Network.DownloadFile(urlResource + item, currentPath + "\pack\" + item)
ProgressBar1.Value = +6
If My.Computer.FileSystem.FileExists(currentPath + "\pack\" + item) Then
consoleLabel.Text = item + "Aggiornato Correttamente"
ProgressBar1.Value = +6
End If
Else
My.Computer.Network.DownloadFile(urlResource + item, currentPath + "\pack\" + item)
consoleLabel.Text = item + "Update Success"
ProgressBar1.Value = +6
End If
Next
ProgressBar1.Value = +4
consoleLabel.Text = "The Client is Update"
consoleLabel.ForeColor = Color.Green
patchButton.Enabled = False
startClient.Enabled = True
startClient.BackColor = Color.Orange
My.Computer.FileSystem.DeleteFile(currentPath + "\" + versionFile)
My.Computer.FileSystem.WriteAllText(currentPath + "\" + versionFile, versionServer, False)
versionLabel.Text = "Version: " + My.Computer.FileSystem.ReadAllText(currentPath + "\" + versionFile)
Me.Update()
End Sub