I want to resume a file in process, that if I close the app and re-run it.
As stated in the title, I'm using the FtpClient.ReceiveMultipleFiles method
as sample of my code is below
Imports Xceed.FileSystem
Imports Xceed.Ftp
Imports Xceed.Synchronization
Imports System.IO
Public Class mainGUI
'determinari conxiune
Dim hostname As String = "my ip"
Dim username As String = "username"
Dim password As String = "password"
Public WithEvents Client As New FtpClient
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
DownloadWorker.RunWorkerAsync()
End Sub
Private Sub OnSynchronizationProgression(ByVal sender As Object, ByVal e As SynchronizationProgressionEventArgs)
ProgressBar.Value = e.ByteProgression.Percent
Application.DoEvents()
End Sub
Private Sub DownloadWorker_DoWork(ByVal sender As System.Object, ByVal e As System.ComponentModel.DoWorkEventArgs) Handles DownloadWorker.DoWork
Client.Connect(hostname, 21)
Client.Login(username, password)
Client.ChangeCurrentFolder("test")
Client.ReceiveMultipleFiles("*", Application.StartupPath & "/Download", True, True)
End Sub
Private Sub OnFileTransferStatus(ByVal sender As Object, ByVal e As FileTransferStatusEventArgs)
ProgressBar.Value = e.AllBytesPercent
End Sub
Private Sub mainGUI_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
Client.SynchronizingObject = Me
Client.PassiveTransfer = True
Client.Timeout = "20"
AddHandler Client.FileTransferStatus, AddressOf Me.OnFileTransferStatus
End Sub
End Class
Now all runs ok, but I want to be able to resume the download in progress if I close the form and return to it later on
How can I do this?