Sub Process_Globals
Private fx As JFX
Private MainForm As Form
Dim Prefs As SLPreferences
End Sub
Sub AppStart (Form1 As Form, Args() As String)
MainForm = Form1
'MainForm.RootPane.LoadLayout("1") 'Load the layout file.
Prefs.Initialize
'Create a byte array
Dim a(5) As Byte = Array As Byte(127,100,130,211,120)
'And store it
Prefs.PutByteArray("test",a)
'Store a string
Prefs.PutString("StrTest","TestStr")
'Get the string, requires a default in case the key is not found
Dim Result As String = Prefs.GetString("StrTest","NF")
If Result = "NF" Then
Log("StrTest not found")
Else
Log(Result)
End If
'Get the byte array, again requires a default with which you can test or use as a default
Dim b(5) As Byte = Prefs.GetByteArray("test",Null)
If b = Null Then
Log("test not found")
Else
'Log the contents of the byte array
For Each i As Byte In b
Log(i)
Next
End If
'Get an array of the keys stored in preferences
Dim Keys() As String = Prefs.GetKeys
'And log them
For Each k As String In Keys
Log(k)
Next
'MainForm.Show
End Sub
Sub MainForm_Closed
Prefs.Flush
End Sub