Developing a library jCCUXML2Map with resumable subs to be used in UI application.
When using in the MainForm the library sub Get_Device_List, nothing happens after Wait For...?
What is wrong in the code?
Note: when using the library code direct and without resumable sub in the Button Click Event, its working.
Example Code Snippet.
MainForm Button Click
Library Code jCCUXML2Map
When using in the MainForm the library sub Get_Device_List, nothing happens after Wait For...?
What is wrong in the code?
Note: when using the library code direct and without resumable sub in the Button Click Event, its working.
Example Code Snippet.
B4X:
Private ccu as CCUXML2Map
B4X:
Private Sub ButtonRefresh_Click
Dim rs As ResumableSub = ccu.Get_Device_List
Wait For(rs) complete (DeviceList As List)
Log("THIS IS NEVER SHOWN")
If DeviceList.Size > 0 Then
' Take Action
End If
End Sub
Library Code jCCUXML2Map
B4X:
Public Sub Get_Device_List As ResumableSub
Dim ReturnList As List
Dim j As HttpJob
ReturnList.Initialize
j.Initialize("", Me)
j.Download(Get_Device_List_Url)
Wait For (j) JobDone(j As HttpJob)
If j.Success Then
ReturnList = Parse_Device_List(j.GetString)
Else
Log($"[ERROR] Get device list failed (${j.ErrorMessage})."$)
End If
j.Release
Return ReturnList
End Sub