有人使用SevenZipSharp包装器成功地中止了正在进行的压缩吗?我用:
FileCompressionStarted(ByVal sender As Object, ByVal e As SevenZip.FileNameEventArgs) 看到一些活动并尝试:
e.cancel = true 但什么都没发生。压缩继续工作,直到所有文件打包。有什么想法吗?
发布于 2012-11-04 08:16:30
已解决并在其他论坛上解释,请参阅链接,谢谢大家
http://www.vbforums.com/showthread.php?697661-RESOLVED-SevenZipSharp-aborting-compression&p=4272389#post4272389
PS。只是为了在这里找到解决方案,以防有人需要
e.cancel在库中没有得到很好的处理,因为当我将e.cancel = true设置一次时,库可能不会捕捉到这个请求。我不确定这是sevenzipsharp.dll问题还是7z.dll问题,但在发布的代码中,当多次点击我的中止按钮时,最后,库中止压缩!
因此,执行工作需要:
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
abort = True
console.addLine("Abort requested...")
End Sub
Private Sub fFileCompressionStarted(ByVal sender As Object, ByVal e As SevenZip.FileNameEventArgs)
Dim s As String = ""
If abort Then
e.Cancel = True
s = " aborted"
End If
console.addLine("[CompressionStarted event] e.Filename = " + e.FileName + ", e.PercentDone = " + e.PercentDone.ToString + s)
End Sub
Public Sub fCompressionFinished(ByVal sender As Object, ByVal e As System.EventArgs)
console.addLine("[CompressionFinished event]")
abort = False
End Sub你好,爱德华·戈拉,YO3HCV
https://stackoverflow.com/questions/13213511
复制相似问题