In the code below (also attached), only one WAIT FOR call works.
If I call the first one, the second one doesn't work, the program just closes without any message.
If I call the first one, the second one doesn't work, the program just closes without any message.
B4X:
#Region Project Attributes
#MainFormWidth: 600
#MainFormHeight: 600
#End Region
Sub Process_Globals
Private fx As JFX
Private MainForm As Form
Private xui As XUI
Dim sp As Form
End Sub
Sub AppStart (Form1 As Form, Args() As String)
MainForm = Form1
MainForm.RootPane.LoadLayout("Layout1")
' if I call liberar after showsplashscreen, the programa closes without any message...
Wait For (ShowSplashScreen) complete (r As Object)
' if I call showsplashscreen and liberar, the programa closes without any message...
' if I call liberar without calling showsplashscreen, liberar works
Wait For (liberar) complete (r As Object)
Log("liberado")
MainForm.Show
End Sub
Sub liberar As ResumableSub
Dim sisweb As HttpJob
sisweb.Initialize("", Me)
sisweb.Download("https://sisweb.app/pix/validar/chaves.txt")
Wait For (sisweb) JobDone(sisweb As HttpJob)
If sisweb.Success Then
Log("chaves ok")
Else
xui.MsgboxAsync("Servidor inacessível. Verifique sua conexão", "SERVIDOR") ' sisweb.app inacessivel
ExitApplication
End If
sisweb.Release
Return Null
End Sub
Sub ShowSplashScreen As ResumableSub
sp.Initialize("sp", 271, 153)
sp.SetFormStyle("TRANSPARENT")
sp.BackColor = fx.Colors.Transparent
CSSUtils.SetBackgroundImage(sp.RootPane, File.DirAssets, "splash.png")
sp.Show
sp.RootPane.Alpha = 0
sp.RootPane.SetAlphaAnimated(500, 1)
Wait For (sp.RootPane) sp_AnimationCompleted
' func.Initialize
'Wait For (liberar) complete (r As Object)
Sleep(2000)
sp.RootPane.SetAlphaAnimated(1000, 0)
Wait For (sp.RootPane) sp_AnimationCompleted
sp.Close
Return Null
End Sub