Как запустить msgbox после завершения процесса распаковки (dotnetzip) в VB.NET
- Привет! У меня есть этот код:
Private Sub KickoffExtract() actionStatus.Text = "Se instaleaza actualizarea.. va rugam asteptati." lblProgress.Text = "Se extrage..." Dim args(2) As String args(0) = GetSettingItem("./updUrl.info", "UPDATE_FILENAME") args(1) = extractPath _backgroundWorker1 = New System.ComponentModel.BackgroundWorker() _backgroundWorker1.WorkerSupportsCancellation = False _backgroundWorker1.WorkerReportsProgress = False AddHandler Me._backgroundWorker1.DoWork, New DoWorkEventHandler(AddressOf Me.UnzipFile) _backgroundWorker1.RunWorkerAsync(args) End Sub Private Sub UnzipFile(ByVal sender As Object, ByVal e As DoWorkEventArgs) Dim extractCancelled As Boolean = False Dim args() As String = e.Argument Dim zipToRead As String = args(0) Dim extractDir As String = args(1) Try Using zip As ZipFile = ZipFile.Read(zipToRead) totalEntriesToProcess = zip.Entries.Count SetProgressBarMax(zip.Entries.Count) AddHandler zip.ExtractProgress, New EventHandler(Of ExtractProgressEventArgs)(AddressOf Me.zip_ExtractProgress) zip.ExtractAll(extractDir, Ionic.Zip.ExtractExistingFileAction.OverwriteSilently) End Using Catch ex1 As Exception MessageBox.Show(String.Format("Actualizatorul a intampinat o problema in extragerea pachetului. {0}", ex1.Message), "Error Extracting", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1) End Try End Sub Private Sub SetProgressBarMax(ByVal n As Integer) If ProgBar.InvokeRequired Then ProgBar.Invoke(New Action(Of Integer)(AddressOf SetProgressBarMax), New Object() {n}) Else ProgBar.Value = 0 ProgBar.Maximum = n ProgBar.Step = 1 End If End Sub Private Sub zip_ExtractProgress(ByVal sender As Object, ByVal e As ExtractProgressEventArgs) If _operationCanceled Then e.Cancel = True Return End If If (e.EventType = Ionic.Zip.ZipProgressEventType.Extracting_AfterExtractEntry) Then StepEntryProgress(e) ElseIf (e.EventType = ZipProgressEventType.Extracting_BeforeExtractAll) Then End If End Sub Private Sub StepEntryProgress(ByVal e As ExtractProgressEventArgs) If ProgBar.InvokeRequired Then ProgBar.Invoke(New ZipProgress(AddressOf StepEntryProgress), New Object() {e}) Else ProgBar.PerformStep() System.Threading.Thread.Sleep(100) nFilesCompleted = nFilesCompleted + 1 lblProgress.Text = String.Format("{0} din {1} fisiere...({2})", nFilesCompleted, totalEntriesToProcess, e.CurrentEntry.FileName) Me.Update() End If End Sub
и этот код на кнопке:
If Not File.Exists("./" + GetSettingItem("./updUrl.info", "UPDATE_FILENAME")) Then MessageBox.Show("Actualizarea nu s-a descarcat corespunzator.", "Nu se poate extrage", MessageBoxButtons.OK) End If If Not String.IsNullOrEmpty("./" + GetSettingItem("./updUrl.info", "UPDATE_FILENAME")) And Not String.IsNullOrEmpty(extractPath) Then If Not Directory.Exists(extractPath) Then Directory.CreateDirectory(extractPath) End If nFilesCompleted = 0 _operationCanceled = False btnUnzip.Enabled = False KickoffExtract() End If
как я могу показать сообщение после завершения процесса распаковки?
Что я уже пробовал:
я пытался:
If ProgBar.Maximum then MsgBox("finish") End If
но это не работает