I would like to show a window "loading" while the system is validated for use.
But the window does not appear over the others, certainly because of operations involving a remote database.
Any idea?
But the window does not appear over the others, certainly because of operations involving a remote database.
Any idea?
B4X:
Sub AppStart (Form1 As Form, Args() As String)
fWait.Initialize("sp", 100, 100)
fWait.SetFormStyle("UNDECORATED")
fWait.SetFormStyle("TRANSPARENT")
fWait.BackColor = fx.Colors.Transparent
CSSUtils.SetBackgroundImage(fWait.RootPane, File.DirAssets, "loading.gif")
fWait.Show ' DOES NOT POPS UP THE FORM DUE TO DATABASE STUFF BELOW
MainForm = Form1
If File.DirApp.ToLowerCase.Contains(desenv) Then
Principal
Return
End If
Try
pool.Initialize(DriverClass, JdbcURL, DBUsername, DBPassword)
Catch
fx.Msgbox(MainForm, LastException, msgErroBanco)
ExitApplication
End Try
If File.Exists(File.DirApp, arqchave) = False Then
chave.Show
Else
schave = File.ReadString(File.DirApp, arqchave)
banco = pool.GetConnection
' apagar sessoes que podem ter ficado "presas"
banco.BeginTransaction
banco.ExecNonQuery(qDeleteOld & Plic(getmac.MacAddressFromClient))
banco.TransactionSuccessful
If chave.ChaveValida(schave) Then
banco.BeginTransaction
Log(getmac.MacAddressFromClient)
banco.ExecNonQuery2(InserirChave, Array(schave, getmac.MacAddressFromClient))
banco.TransactionSuccessful
banco.Close
pool.ClosePool
Principal ' main sub
Else
banco.Close
chave.Show
End If
End If
End Sub