Dim eventdb As Map
Dim eventlistview As ListView
End Sub
Sub AppStart (Form1 As Form, Args() As String)
MainForm = Form1
'MainForm.RootPane.LoadLayout("Layout1") 'Load the layout file.
MainForm.Show
eventlistview.Initialize("")
MainForm.RootPane.AddNode(eventlistview,10,10,400,500)
eventdb.Initialize
' some dummy data
add("one","12:00",3,"Topic1","Val1")
add("two","13:00",4,"Topic2","Val2")
add("three","15:00",6,"Topic3","Val3")
' add individual maps by name
AddToList("one")
AddToList("three")
' or add all maps
For Each k As String In eventdb.Keys
AddToList(k)
Next
End Sub
Public Sub add(eventname As String, eventtime As String, eventdays As Int, eventtopic As String, eventval As String)
Dim event As Map
event.Initialize
event.Put("Name",eventname)
event.Put("Time",eventtime)
event.Put("Days",eventdays)
event.Put("MQTTTopic",eventtopic)
event.Put("MQTTVal",eventval)
eventdb.Put(eventname, event)
End Sub
Private Sub AddToList(key As String)
Dim event As Map = eventdb.Get(key)
Dim string1 As String
string1 = event.Get("Name") & " | "
string1 = string1 & event.Get("Time") & " | "
string1 = string1 & NumberFormat(Bit.ToBinaryString(event.Get("Days")),8,0) & " | "
string1 = string1 & event.Get("MQTTTopic") & " | "
string1 = string1 & event.Get("MQTTVal")
eventlistview.Items.Add(string1)
End Sub