Private Sub B4XPage_Created (Root1 As B4XView)
Root = Root1
Root.LoadLayout("Main")
B4XPages.SetTitle(Me, "WAVEDESK ERP")
Drawer.Initialize(Me, "Drawer", Root, 250dip)
Drawer.CenterPanel.LoadLayout("Main")
Drawer.LeftPanel.LoadLayout("Menu")
#If B4i
HamburgerIcon = xui.LoadBitmapResize(File.DirAssets, "hamburger.png", 32dip, 32dip, True)
#End if
#If B4a
HamburgerIcon = xui.LoadBitmapResize(File.DirAssets, "hamburger_black.png", 32dip, 32dip, True)
#End If
#if B4i
Dim bb As BarButton
bb.InitializeBitmap(HamburgerIcon, "hamburger")
B4XPages.GetNativeParent(Me).TopLeftButtons = Array(bb)
#end if
'Get the details of the user
Dim j As HttpJob
j.Initialize("", Me)
j.Download(Main.BaseUrl & "users/details")
j.GetRequest.SetHeader("Authentication", "bearer " & Main.Token)
Wait For (j) JobDone(j As HttpJob)
If j.Success Then
Dim parser As JSONParser
parser.Initialize(j.GetString)
Dim jRoot As Map = parser.NextObject
LblUserName.Text = jRoot.Get("firstname") & " " & jRoot.Get("name")
LblUserEmail.Text = jRoot.Get("email")
Main.UserId = jRoot.Get("id")
Main.User_access_article_list = jRoot.Get("access_article_list")
j.Release
Else
LblUserName.Text = ""
LblUserEmail.Text = ""
j.Release
End If
Build_menu
Drawer.LeftPanel.BringToFront