Sub Process_Globals
....
Private pnlRoot As Panel
End Sub
Private Sub Application_Start (Nav As NavigationController)
NavControl = Nav
Page1.Initialize("Page1")
pnlRoot.Initialize("")
Page1.RootPanel.AddView(pnlRoot, 0, 0, 200, 200)
InitApp
...
End Sub
Private Sub Page1_Resize(Width As Int, Height As Int)
Log("Page1_Resize")
If pnlRoot.IsInitialized Then
Dim r As Rect = Page1.SafeAreaInsets
pnlRoot.SetLayoutAnimated(0, 1, r.Left, r.Top, Width - r.Right - r.Left, Height - r.Bottom - r.Top)
Sleep(100)
End If
...
End Sub
Private Sub InitApp
If pnlRoot.IsInitialized Then
pnlRoot.RemoveAllViews
If IsPadDevice Then
pnlRoot.LoadLayout("frmMainIpad")
SetOrientation(3)
else if IsPhonePlus And manager.GetString("rbtOrientationModus") = language.value("strLandscape") Then
pnlRoot.LoadLayout("frmMainIpad")
SetOrientation(3)
Else
pnlRoot.LoadLayout("frmMainIphone")
SetOrientation(1)
End If
Else
Page1.RootPanel.RemoveAllViews
If IsPadDevice Then
Page1.RootPanel.LoadLayout("frmMainIpad")
SetOrientation(3)
else if IsPhonePlus And manager.GetString("rbtOrientationModus") = language.value("strLandscape") Then
Page1.RootPanel.LoadLayout("frmMainIpad")
SetOrientation(3)
Else
Page1.RootPanel.LoadLayout("frmMainIphone")
SetOrientation(1)
End If
End If
End Sub
Public Sub IsPhonePlus As Boolean
If GetDeviceLayoutValues.DeviceApproximateScreenSize > 5 Then
Return True
Else
Return False
End If
End Sub
Public Sub SetOrientation(landscape As Int)
Dim no As NativeObject
no.Initialize("UIDevice").RunMethod("currentDevice", Null).SetField("orientation", landscape)
End Sub