Sub show_log
'Log-Datei anzeigen und evl. löschen
Dim cd As CustomDialog
Dim pnl As Panel
pnl.Initialize("pnl")
Dim bgnd As ColorDrawable
bgnd.Initialize(Colors.RGB(250, 250, 210), 5dip)
pnl.Background = bgnd
'
'
scvText.Initialize(100) ' initialize the Scrollview
'Activity.AddView(scvText, 0, 0, 100%x, 100%y) ' add the Scrollview on the Activity
pnl.AddView(scvText, 0, 0, 650, 380) ' add the Scrollview on the Activity
'
lblText.Initialize("") ' initialize the Label for the text, without an EventName
scvText.Panel.AddView(lblText, 0, 0 ,100%x, 100%y) ' add the Label on the ScrollView internal Panel
lblText.Color = Colors.RGB(250, 250, 210) ' set the Label background color
lblText.TextColor = Colors.Black ' set the Label text color
'
LoadText ' load the text
SetText ' set the text
'
cd.AddView(pnl, 0%x, 0%y, 650,400)
'
ret = cd.Show("interne Log-Datei", "Fenster schliessen","Log-Datei leeren","", Bild4)
If ret = DialogResponse.POSITIVE Then
helfen_Click
Else If ret = DialogResponse.CANCEL Then
Writer.Close
Writer.Initialize(File.OpenOutput (ListDir, "LF.log", False))
AddLog("Log-Datei wurde vom Benutzer geleert - OK")
show_log
End If
End Sub
Sub LoadText
Writer.Close
'
txt = File.GetText(ListDir, "LF.log") ' load the text file into the string
'
Writer.Initialize(File.OpenOutput (ListDir, "LF.log", True))
End Sub
Sub SetText
Dim ht As Float
'
lblText.Text = txt ' set the text string to the Label text property
ht = StrUtil.MeasureMultilineTextHeight(lblText, txt) ' measure Label height
scvText.Panel.Height = ht ' set the ScrollView internal Panel height to the measured height
lblText.Height = ht ' set the Label height to the measured height
'
scvText.ScrollPosition = 0 ' set the scroll position to the top of the text
DoEvents ' needed to execute the previous line
End Sub
Sub AddLog(was As String)
Dim now As Long
now = DateTime.now
Writer.WriteLine( DateTime.Date(now)&" "&DateTime.Time(now)&" - " & was)
End Sub