Hello!
I am bit of a newbie with vb.net coding in general and rebex in particular, so, can you help me out a bit?
What I am trying to do is retry download action, but for some reason it crashes application. When debugging it suggests using "Invoke" in different parts NOT related to actual download, so, using it does not not help, so I'm guessing I'm doing something wrong.
In short, I initiate BeginDownload
like this:
Dim result As IAsyncResult = FTP.BeginDownload(commonfolder, steamlocation & "\steamapps\common", TraversalMode.Recursive, TransferMethod.Copy, ActionOnExistingFiles.OverwriteDifferentSize, New AsyncCallback(AddressOf FinishCommonDownload), Nothing)
FinishCommonDownload
in turn downloads some more files to a different folder, and calls another download similar to it. I the end FinishLoad is called:
Private Sub FinishLoad(ByVal result2 As IAsyncResult)
MsgBox(result2)
Dim dfail As Integer
Try
FTP.EndDownload(result2)
Catch ex As Exception
MessageBox.Show(ex.ToString())
dfail = dfail + 1
End Try
Disconnect()
If dfail <> 1 Then
NotifyIcon.BalloonTipIcon = ToolTipIcon.Info
NotifyIcon.BalloonTipTitle = "Download completed"
NotifyIcon.BalloonTipText = "Your download of " & gameloaded & " is now completed" & vbNewLine & "Enjoy :)"
NotifyIcon.ShowBalloonTip(5000)
Else
MsgBox("Your download of " & gameloaded & " has failed" & vbNewLine & "Please, retry")
End If
If (Me.InvokeRequired) Then
Me.Invoke(New Action(Of Boolean)(AddressOf SetState), New Object() {False})
End If
End Sub
I tried calling my download function from the "Catch", but when it comes back to the "Dim result..." part it crashes the app. And does not seem like debugger catches this exact exception.
I'm getting a hunch, that this is a wrong move :D I tried to understand, how I should use "Retry" method, which Rebex should have, but, as I said, I am a noob and do not get how I should do it. Can someone, please, assist?
BTW, even though it says FTP it's actually SFTP ;)