Sub Activity_Create (FirstTime As Boolean)
'---------------------------------------------------------------
' Fetch PV power data from SQLite DB on NAS, calculate work data and plot result
'---------------------------------------------------------------
PanelMainPortrait.Initialize("")
PanelPlotPortrait.Initialize("")
PanelMainLandscape.Initialize("")
PanelPlotLandscape.Initialize("")
Activity.AddView(PanelMainPortrait, 0, 0, 100%x, 100%y)
Activity.AddView(PanelPlotPortrait, 0, 0, 100%x, 100%y)
Activity.AddView(PanelMainLandscape, 0, 0, 100%x, 100%y)
Activity.AddView(PanelPlotLandscape, 0, 0, 100%x, 100%y)
PanelMainPortrait.LoadLayout("MainPanelPortrait")
PanelPlotPortrait.LoadLayout("PlotPanelPortrait")
PanelMainLandscape.LoadLayout("MainPanelLandscape")
PanelPlotLandscape.LoadLayout("PlotPanelLandscape")
If FirstTime Then
SpinnerChartType.AddAll(SpinnerArray)
SpinnerChartType.Color=Colors.LightGray
SpinnerChartType.SelectedIndex = 0
iChartTypeSelection = 0
HeadlineMainPortrait.Text = "SQL Query of Power Values and Energy Calculation"
HeadlinePlotPortrait.Text = "Plot Power or Works Data"
lPlotMode = False
End If
ScreenHeight=Activity.Height
ScreenWidth=Activity.Width
If ScreenHeight > ScreenWidth Then
' Screen not rotated (height > width)
lRotation = False
Else
' Screen rotated (height <= width)
lRotation = True
End If
ScreenPanel (True, False)
If lPlotMode = True Then ButtonPlot_click
End Sub