FTP: How Can I Make the Msgbox Display the Message

Mahares

Expert
Licensed User
Longtime User
How can I make the below code stop at the msgbox and display when it succeeds and when it fails. It does not stop even with the msgbox in the code.
B4X:
'DOWNLOAD COMPLETED
   Sub FTP_DownloadCompleted (ServerPath As String, Success As Boolean)
       Log(ServerPath & ", Success=" & Success)
       If Success = False Then          
           Msgbox(LastException.Message & ". No Files were downloaded to device.".ToUpperCase,"")
            'Log(LastException.Message)
            Return
      Else
           Msgbox("Files downloaded successfully to device.","")
      End If
   End Sub
 

Mahares

Expert
Licensed User
Longtime User
Since the DownloadCompleted is called after each file, it does not look like I am going to be able to achieve what I want, which is one final message box after all the downloads succeed and one message box after the failures, even with mc73 code below. The msgbox does not fire at all:

B4X:
Dim ProcessFinishedFlag(6)As Boolean
Dim DownloadCounter ,TotalDownloads As Int            :DownloadCounter=0
B4X:
'DOWNLOAD COMPLETED
   Sub FTP_DownloadCompleted (ServerPath As String, Success As Boolean)
      ProcessFinishedFlag(DownloadCounter)=Success
      DownloadCounter=DownloadCounter+1
      Dim k As Int
      If DownloadCounter=TotalDownloads Then
         Dim s As String         :s=""
         For k=0 To TotalDownloads-1
            s=s & "Download #: " & (k+1) & " "
            If ProcessFinishedFlag(k)=False Then 
               s=s & " Failed, " 
            Else 
               s=s & " Succeeded, "
            End If
         Next
         Msgbox(s,"Final results")
      End If
   End Sub
 
Upvote 0

Mahares

Expert
Licensed User
Longtime User
@mc73: Do you have any more creative ideas because all I want is this: One final message box after all the downloads succeed and one message box after the failures.
 
Upvote 0

mc73

Well-Known Member
Licensed User
Longtime User
@mc73: Do you have any more creative ideas because all I want is this: One final message box after all the downloads succeed and one message box after the failures.

I'll have a look and see what's going wrong.
 
Upvote 0
Cookies are required to use this site. You must accept them to continue using the site. Learn more…