Sub Process_Globals
'These global variables will be declared once when the application starts.
'Public variables can be accessed from all modules.
Public App As Application
Public NavControl As NavigationController
Private Page1 As Page
Private PieChart1 As PieChart
Private Root As Panel
End Sub
Private Sub Application_Start (Nav As NavigationController)
NavControl = Nav
Page1.Initialize("Page1")
Root.Initialize("Root")
Page1.RootPanel.AddView(Root, 0, 0, Page1.RootPanel.Width, Page1.RootPanel.Height)
Page1.RootPanel.Color = Colors.White
Root.LoadLayout("1")
NavControl.ShowPage(Page1)
End Sub
Private Sub Page1_Resize(Width As Int, Height As Int)
'Log($"Input: ${Width} x ${Height}"$)
Dim top = 0, left = 0 As Int
If App.OSVersion >= 11 Then
Dim no As NativeObject = Page1.RootPanel
no = no.GetField("safeAreaInsets")
Dim matcher As Matcher = Regex.Matcher("\{(.*)\}", no.AsString.Replace(" ", ""))
If matcher.Find Then
Dim values() As String = Regex.Split(",", matcher.Group(1))
Log(matcher.Group(1))
top = top + values(0)
left = left + values(1)
Height = Height - values(2) - top
Width = Width - values(3) - left
End If
End If
'Log($"top: ${top}, left: ${left}, height: ${Height}, width: ${Width}"$)
Root.SetLayoutAnimated(0, 1, left, top, Width, Height)
End Sub