Sub Class_Globals
Private Root As B4XView
Private xui As XUI
private Writer As TextWriter
Private btnAdd As Button
Private btnWriterOpen As Button
Private btnWriterclose As Button
End Sub
Public Sub Initialize
' B4XPages.GetManager.LogEvents = True
End Sub
'This event will be called once, before the page becomes visible.
Private Sub B4XPage_Created (Root1 As B4XView)
Root = Root1
Root.LoadLayout("MainPage")
End Sub
Private Sub btnAdd_Click
If Writer.IsInitialized = False Then
xui.MsgboxAsync("Writer non inizializzato","")
Else
TextWrite("Test1")
TextWrite("Test2")
TextWrite("Test3")
TextWrite("Test4")
TextWrite("Test5")
TextWrite("Test6")
End If
End Sub
private Sub TextWrite(text As String)
Writer.WriteLine(text)
Writer.Flush
End Sub
Private Sub btnWriterOpen_Click
If Writer.IsInitialized = False Then
Writer.Initialize(File.OpenOutput("C:\Users\pc\Desktop", "\test.txt", True))
Else
xui.MsgboxAsync("Writer già inizializzato","")
End If
End Sub
Private Sub btnWriterclose_Click
If Writer.IsInitialized = True Then
Writer.Close
Writer = Null
Else
xui.MsgboxAsync("Writer non inizializzato","")
End If
End Sub