Cannot cancel within AddProgress event


Thanks for the link. The AddProgress event is working, but I am unable to cancel the operation.

I tried both of these handlers seperately:
                'AddHandler Zip.AddProgress, New EventHandler(Of AddProgressEventArgs)(AddressOf Zip_AddProgress)                    AddHandler Zip.AddProgress, AddressOf Zip_AddProgress

Private Sub Zip_AddProgress(ByVal sender As Object, ByVal e As AddProgressEventArgs)
    If bwBackup.CancellationPending Then e.Cancel = True 'If we press the stop button, invoke Cancel. RunWorkerCompleted will be called.        MsgBox("hi")
    Select Case e.EventType            Case ZipProgressEventType.Adding_Started                'code removed; update status label here.                Exit Select            Case ZipProgressEventType.Adding_AfterAddEntry                'code removed; update status label here.                'e.Cancel = True                Exit Select        End Select
End Sub

The labels update as expected, and the message box fires constantly, as I would expect it to. However, e.Cancel is not working. Bypassing the background worker and directly cancelling the operation in Adding_AfterAddEntry (now commented out), did not work either. The operation continues until the SaveProgress phase, where it is cancelled immediately due to the previous call to bwBackup.CancelAsync.
Closed Jun 16, 2011 at 5:36 PM by Cheeso
This change is implemented in changeset 79281. The first binary to contain this new feature is v1.9.1.6


Aerowinder wrote Apr 20, 2011 at 2:20 AM

If the adding process cannot be cancelled through e.Cancel, is there another way to do it? You can use:

If bwWorker.CancellationPending Then Exit Sub

This seems to be ineffective.

wrote Jun 13, 2011 at 7:22 PM

wrote Jun 16, 2011 at 5:36 PM

wrote Feb 22, 2013 at 1:43 AM

wrote May 16, 2013 at 12:31 PM