AppStart (Form1 As Form, args() As String)
Try
MainForm=Form1
MainForm.RootPane.LoadLayout("Main")
MainForm.SetFormStyle("DECORATED")
MainForm.Stylesheets.Add(File.GetUri(File.DirAssets, "TabPane.css"))
MainForm.Title="Collection Management System"
TabPane1.StyleClasses.Add("tab-pane")
TabPane1.LoadLayout("ObjDetailsTab", "Details")
TabPane1.LoadLayout("ObjProvTab", "History/Provenance")
TabPane1.LoadLayout("ObjSignTab", "Significance")
TabPane1.LoadLayout("ObjImageTab", "Image")
Toast.Initialize("Toast")
Toast.ToastIconSize32x32
Toast.ToastDuration = 6 'Toast.TOAST_LONG_DELAY
Toast.ToastTextLocation = Toast.TEXT_CENTER
Toast.ToastLocation= Toast.TOAST_CENTER_RIGHT
Toast.ToastMessageColor = fx.Colors.Green
'open database and show Objects in Tableview
'Log(GetSystemProperty("user.home",""))
Utils.CreateSqlDatabase
SQL1.InitializeSQLite(Utils.DBaseFilePath, "scm.db3", False)
strQuery = "SELECT _id[ID], Accession[Accn No.], Name[Object Name] FROM Objects Order BY Name;"
DBUtils.ExecuteTableview(SQL1,strQuery,Null,0,tblObjEdit)
tblObjEdit.SetColumnVisible(0,False)
tblObjEdit.SetColumnWidth(1,80)
tblObjEdit.SetColumnWidth(2,200)
'load search combo box
cboSearch.Value="ALL"
cboSearch.Items.AddAll(Array As String("ALL", "Accession", "Name", "AccBy", "AccDate", "Aesthetic","CondNote", "Condition", "CulturalValue","CurrentLoc","Conservator", "ConsDate","DateMade", "Description", "Export", "History", "Historic","Loan", "ObjectSet", "ObjectType", "PrimaryClass","ProvCount", "Scientific","SecondClass","Social", "Storage"))
'Load units
strQuery="Select Units from SetUp Where _id=1"
Dim m As Map
m = DBUtils.ExecuteMap(SQL1, strQuery, Null)
lblUnits.Text=m.Get("units")
Units=lblUnits.Text
'splash screen - title screen -
Splash.Initialize("frmStartup", 500, 500)
Splash.RootPane.LoadLayout("Startup.bjl")
Splash.Resizable=False
Splash.SetFormStyle("UNDECORATED")
lblName.Text=ProgName
lblVersion.Text=ProgVersion
lblCopyright.text=Copyright
Timer1.Initialize("Timer1", 2000)
Splash.show
Timer1.Enabled=True
Catch
LogDebug(Utils.DBaseFilePath)
RedirectOutput(Utils.DBaseFilePath, "logs.txt")
End Try
End Sub
Sub RedirectOutput (Dir As String, FileName As String)
'#if RELEASE
Dim out As OutputStream = File.OpenOutput(Dir, FileName, True) 'Set to True to append the logs
Dim ps As JavaObject
ps.InitializeNewInstance("java.io.PrintStream", Array(out, True, "utf8"))
Dim jo As JavaObject
jo.InitializeStatic("java.lang.System")
jo.RunMethod("setOut", Array(ps))
jo.RunMethod("setErr", Array(ps))
'#end if
End Sub
Sub Timer1_tick
Splash.Close
MainForm.show
End Sub