Private Sub Application_Start (Nav As NavigationController)
NavControl = Nav
Splash.Initialize("Splash")
Splash.RootPanel.LoadLayout("Splash")
NavControl.ShowPage(Splash)
lblVersion.Text = "Versie: "& GetVersion
reqManager.Initialize(Me, rdcLink)
' only for testing, removes the database
'File.Delete(SQLDataBasePath, SQLDateBaseName)
'check if the database already exists
If File.Exists(SQLDataBasePath, SQLDateBaseName) = False Then
'copy the default DB
File.Copy(File.DirAssets, SQLDateBaseName, SQLDataBasePath, SQLDateBaseName)
'if not, initialize it
SQL1.Initialize(SQLDataBasePath, SQLDateBaseName, True)
'and create it
'CreateDataBase
Else
'if yes, initialize it
SQL1.Initialize(SQLDataBasePath, SQLDateBaseName, True)
End If
bInit = True
' ReadDataBaseIDs
'Read gKassaId from local DB
gKassaId = 12
'cleanup local database table first
delete_local_table("ToetsenbordTabsPhone")
wait for (Load_ButtonsTabs(1)) complete (Result As Boolean)
If Result Then
Log("Connected data fetched")
Else
Msgbox2("Msg" , "Error connecting to Server: " & rdcLink, "I-XzPOS", Array ("OK"))
Wait For Msg_Click (ButtonText As String)
If ButtonText = "OK" Then
Return
End If
End If
'cleanup local database table first
delete_local_table("ToetsenbordPhone")
wait for (Load_Buttons(1)) complete (Result As Boolean)
'cleanup local database table first
delete_local_table("BTW")
wait for (Load_BTW) complete (Result As Boolean)
'cleanup local database table first
delete_local_table("Artikel")
wait for (Load_Artikel) complete (Result As Boolean)
'cleanup local database table first
delete_local_table("Prijs")
wait for (Load_Prijs) complete (Result As Boolean)
'Attempt to connect and get Current shift
wait for (Get_ServerShiftID) complete (Result As Boolean)
SQLMain.Initialize("SQLMain")
SQLMain.RootPanel.LoadLayout("SQLMain")
StartMenu.Show
End Sub
Sub Load_ButtonsTabs(GroepId As Int) As ResumableSub
Dim req As DBRequestManager = CreateRequest
Dim cmd1 As DBCommand = CreateCommand("select_ToetsenbordTabsPhone", Array(GroepId))
Dim Query As String
Dim rs As ResultSet
Dim Values(4) As String
HUD1.ProgressDialogShow("Laden ToetsenTab tabel")
'prepare sql for insert into local table
Query = "INSERT INTO ToetsenbordTabsPhone VALUES (?,?,?,?)"
'retrieve from server database
Wait For (req.ExecuteQuery(cmd1, 0, Null)) JobDone(j As HttpJob)
If j.Success Then
req.HandleJobAsync(j,"req")
wait for (req) req_result(res As DBResult)
Log(res.Columns)
For Each row() As Object In res.Rows
Values(0) = row(0)
Values(1) = row(1)
Values(2) = row(2)
Values(3) = row(3)
SQL1.ExecNonQuery2(Query, Values)
Log(rs)
Next
Else
Log("ERROR: " & j.ErrorMessage)
End If
j.Release
HUD1.ProgressDialogHide
Return j.Success
End Sub