Private Sub stat_Click
Dim ff As DownloadData
ff.url = "https://exemple/..."
ff.EventName = "ff"
ff.Target = Me
CallSubDelayed2(DownloadService, "StartDownload", ff)
Wait For ff_fin
'si téléchargement est OK
If download=True Then
....
End Sub
Sub ff_Complete(Job As HttpJob)
If Job.Success Then
Dim out As OutputStream = File.OpenOutput(File.DirInternal, "api.csv", False)
File.Copy2(Job.GetInputStream, out)
out.Close
download=True
Job.Release
CallSubDelayed(Me,"ff_fin")
Else
download=False
Job.Release
CallSubDelayed(Me,"ff_fin")
End If
End Sub