#Region Shared Files
#CustomBuildAction: folders ready, %WINDIR%\System32\Robocopy.exe,"..\..\Shared Files" "..\Files"
'Ctrl + click to sync files: ide://run?file=%WINDIR%\System32\Robocopy.exe&args=..\..\Shared+Files&args=..\Files&FilesSync=True
#End Region
'Ctrl + click to export as zip: ide://run?File=%B4X%\Zipper.jar&Args=Project.zip
Sub Class_Globals
Private Root As B4XView
Private xui As XUI
Public kvs As KeyValueStore
Public dashboard As pDashboard
Private edtName As B4XView
Private btnLogin As B4XView
Private imgLogin As B4XImageView
End Sub
Public Sub Initialize
' B4XPages.GetManager.LogEvents = True
kvs.Initialize(xui.DefaultFolder, "ksv.db")
'se já estiver logado abre a proxima tela
If kvs.ContainsKey("user") Then
Log("logged in user:" & kvs.ContainsKey("user"))
B4XPages.AddPage("dashboard", dashboard.Initialize)
B4XPages.ShowPageAndRemovePreviousPages("dashboard")
Else
Log("no user logged in")
End If
End Sub
Private Sub B4XPage_Created (Root1 As B4XView)
Root = Root1
Root.LoadLayout("login")
If dashboard.IsInitialized = False Then
B4XPages.AddPage("dashboard", dashboard.Initialize)
End If
imgLogin.Bitmap = xui.LoadBitmap(File.DirAssets, "logo.png")
edtName.SetColorAndBorder(0xFFF2F2F2,1dip, 0xFFD8D8D8, 10dip)
btnLogin.SetColorAndBorder(0xFF02BDDE,0, 0, 10dip)
End Sub
Private Sub B4XPage_Appear
End Sub
Private Sub btnLogin_Click
kvs.put("user", edtName.Text)
B4XPages.ShowPageAndRemovePreviousPages("dashboard")
End Sub