Initial Comit
This commit is contained in:
94
DPMCharge/Param.bas
Normal file
94
DPMCharge/Param.bas
Normal file
@@ -0,0 +1,94 @@
|
||||
B4A=true
|
||||
Group=Default Group
|
||||
ModulesStructureVersion=1
|
||||
Type=Activity
|
||||
Version=11
|
||||
@EndOfDesignText@
|
||||
#Region Activity Attributes
|
||||
#FullScreen: False
|
||||
#IncludeTitle: True
|
||||
#End Region
|
||||
|
||||
Sub Process_Globals
|
||||
'These global variables will be declared once when the application starts.
|
||||
'These variables can be accessed from all modules.
|
||||
|
||||
|
||||
End Sub
|
||||
|
||||
Sub Globals
|
||||
'These global variables will be redeclared each time the activity is created.
|
||||
'These variables can only be accessed from this module.
|
||||
|
||||
Private txtUrl As EditText
|
||||
Private btnParamSave As Button
|
||||
Private btnParamCancel As Button
|
||||
Private txtTimeout As EditText
|
||||
End Sub
|
||||
|
||||
Sub Activity_Create(FirstTime As Boolean)
|
||||
'Do not forget to load the layout file created with the visual designer. For example:
|
||||
|
||||
Activity.LoadLayout("Parameter")
|
||||
If File.Exists(File.DirInternal ,"DPM.ini") = True Then
|
||||
Get_Params
|
||||
End If
|
||||
End Sub
|
||||
|
||||
Sub Get_Params
|
||||
Try
|
||||
Dim TR As TextReader
|
||||
Dim inp As InputStream
|
||||
inp=File.OpenInput(File.DirInternal , "DPM.ini")
|
||||
TR.Initialize(inp)
|
||||
Try
|
||||
txtUrl.Text=TR.Readline
|
||||
Catch
|
||||
txtUrl.Text=""
|
||||
End Try
|
||||
Try
|
||||
txtTimeout.Text=TR.ReadLine
|
||||
Catch
|
||||
txtTimeout.Text=30000
|
||||
End Try
|
||||
TR.Close
|
||||
Catch
|
||||
End Try
|
||||
End Sub
|
||||
|
||||
Sub Activity_Resume
|
||||
|
||||
End Sub
|
||||
|
||||
Sub Activity_Pause (UserClosed As Boolean)
|
||||
|
||||
End Sub
|
||||
|
||||
Private Sub btnParamSave_Click
|
||||
txtUrl.ForceDoneButton=False
|
||||
Save_Parameter(txtUrl.Text,False)
|
||||
Save_Parameter(txtTimeout.Text,True)
|
||||
Activity.Finish
|
||||
StartActivity("main")
|
||||
End Sub
|
||||
|
||||
Private Sub btnParamCancel_Click
|
||||
txtUrl.ForceDoneButton=False
|
||||
Activity.Finish
|
||||
StartActivity("main")
|
||||
'Activity.LoadLayout("main")
|
||||
|
||||
End Sub
|
||||
|
||||
Sub Save_Parameter(url As String,append As Boolean)
|
||||
Dim Tw As TextWriter
|
||||
Dim out As OutputStream
|
||||
|
||||
out = File.OpenOutput(File.DirInternal , "DPM.ini",append)
|
||||
Tw.Initialize(out)
|
||||
|
||||
Tw.WriteLine(url)
|
||||
Tw.Flush
|
||||
Tw.close
|
||||
|
||||
End Sub
|
||||
Reference in New Issue
Block a user