Sub ScaricaImmagini
Log(ftpjobs.Size)
Dim ok As Boolean
ok = True
For i = 0 To ftpjobs.Size-1
If ok = True Then
Try
FTP.DownloadFile("/immagini/"&ftpjobs.Get(i), False, sdRoot&"/img/", ftpjobs.Get(i))
Wait For FTP_DownloadCompleted (ServerPath As String, Success As Boolean)
Log(ftpjobs.Get(i)&" - "&Success)
CircularProgressBar1.Value = (totimmagini-(i+1))
If ChkLog.Checked=True Then
TxtLog.Text = "Download file "&(i+1)&" di "&totimmagini&" "&ServerPath &" completato"&Chr(10)&TxtLog.Text
End If
If Success = False Then
File.Delete(Main.sdRoot&"emmeci/gemitex/img/",ftpjobs.Get(i))
ok = False
Exit
Else
'Sleep(500)
End If
Catch
ok = False
Exit
End Try
End If
Next
FTP.Close
CircularProgressBar1.Value = 100
If ok = False Then
Msgbox2("Errore di Collegamento, Riprovare!",Main.nomeprog,"","Ok","",LoadBitmap (File.DirAssets, "warning_gemitex.png"))
Else
Msgbox2("Ricezione completata!",Main.nomeprog,"","Ok","",LoadBitmap (File.DirAssets, "warning_gemitex.png"))
End If
TxtLog.Visible = False
LblStatus.Visible = False
Awake.ReleaseKeepAlive 'togliamo lo standby
BtnInvia.Enabled = True
BtnRicevi.Enabled = True
BtnExit.Enabled = True
Activity.Finish
StartActivity(Main)
End Sub