iOS Question FTP and HUD

moore_it

Well-Known Member
Licensed User
Longtime User
Hi all,
have a problem with ftp and hud, when i start a hud for example :

B4X:
Sub testftp
    Globals.gHud.ProgressDialogShow("Connessione al server ftp")
    myFtp.Initialize("myFTPTest",server,port,user,password)
    myFtp.List(path)
End Sub

Sub myFTPTest_ListCompleted(ServerPath As String, Success As Boolean, Folders() As FTPEntry, Files() As FTPEntry)
    Globals.gHud.ProgressDialogHide
    If Success Then
        Msgbox("Connessione effettuata con successo !","Connessione FTP")
    Else
        Msgbox("Riscontrati errori nella connessione ..."&Chr(13)&LastException,"Errori connessione FTP")       
    End If
End Sub

this work fine
when i use this code

B4X:
Sub down_def
    Globals.gHud.ProgressDialogShow("Connessione al server ftp")
    myFtpDefs.Initialize("myFTPDefs",server,port,user,password)
    myFtpDefs.List(path&"DEFS/")
End Sub

Sub myFTPDefs_ListCompleted(ServerPath As String, Success As Boolean, Folders() As FTPEntry, Files() As FTPEntry)
    If Success Then
        ftpFiles.Initialize
        For i = 0 To Files.Length - 1
            ftpFiles.Add(Files(i).Name)
        Next
        If ftpFiles.Size > 0 Then
            Dim s As String
            s = ftpFiles.Get(0)   
            If File.Exists(File.DirDocuments & "/DEFS",s.ToUpperCase) Then
                File.Delete(File.DirDocuments & "/DEFS",s.ToUpperCase)
            End If
            Globals.gHud.ProgressDialogShow("Download del file : "&s)
            myFtpDefs.DownloadFile(path&"DEFS/"&ftpFiles.Get(0),False,File.DirDocuments&"/DEFS",s.ToUpperCase)
        Else
            Globals.gHud.ProgressDialogHide
            Msgbox("Nessun file trovato.","Download")       
        End If
    Else
        Globals.gHud.ProgressDialogHide       
        Msgbox("Riscontrati errori nella connessione ..."&Chr(13)&LastException,"Errori connessione FTP")
    End If
End Sub

Sub myFTPDefs_DownloadCompleted (ServerPath As String, Success As Boolean)
    If Success Then
        Globals.gHud.ProgressDialogShow("Scaricato file : "&ftpFiles.get(0))
        ftpFiles.RemoveAt(0)
        If ftpFiles.Size > 0 Then
            Dim s As String
            s = ftpFiles.Get(0)   
            If File.Exists(File.DirDocuments & "/DEFS",s.ToUpperCase) Then
                File.Delete(File.DirDocuments & "/DEFS",s.ToUpperCase)
            End If
            Globals.gHud.ProgressDialogShow("Download del file : "&s)
            myFtpDefs.DownloadFile(path&"DEFS/"&ftpFiles.Get(0),False,File.DirDocuments&"/DEFS",s.ToUpperCase)
        Else
            Globals.gHud.ProgressDialogHide
            Msgbox("Download dati di definizione eseguita correttamente !","Download")
        End If               
    Else
        Msgbox("Errore download file def : "&ftpFiles.Get(0),"Errore")
        Globals.gHud.ProgressDialogHide
    End If
End Sub

the hud dead at listCompleted
why ?

thanks in advice !
 
Top