#Region Project Attributes
#ApplicationLabel: PROTIME SMS Alert
#VersionCode: 1
#VersionName:
'SupportedOrientations possible values: unspecified, landscape or portrait.
#SupportedOrientations: unspecified
#CanInstallToExternalStorage: False
#End Region
#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.
Dim sftp1 As SFtp
Dim database As SQL
Dim lstSms As List
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 BtsLstFiles As Button
Private ListView1 As ListView
Private EditText1 As EditText
Private btnReadCSV As Button
Private btnFlushData As Button
Private btnCompare As Button
Private btnSendSms As Button
End Sub
Sub Activity_Create(FirstTime As Boolean)
'Do not forget to load the layout file created with the visual designer. For example:
If FirstTime Then
' DATABASE
DB.CreateDatabase
' SFTP
sftp1.Initialize("sftp1", "XXXXX_SFTP", "7&", "server.domain.fr", 22)
sftp1.SetKnownHostsStore(File.DirInternal, "hosts.txt")
'AUTRES
lstSms.Initialize
End If
Activity.LoadLayout("L1")
End Sub
Sub Activity_Resume
sftp1.Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
Sub sftp1_PromptYesNo (Message As String)'
'sftp1.SetPromptResult(True)
Dim res As Int = Msgbox2(Message, "", "Yes", "", "No", Null)
'The next line might be a bit confusing. It is a condition.
'The value will be True if res equals to DialogResponse.POSITIVE.
sftp1.SetPromptResult(res = DialogResponse.POSITIVE)
End Sub
Sub sftp1_ShowMessage (Message As String)
Msgbox(Message, "")
End Sub
Sub BtsLstFiles_Click
sftp1.List(EditText1.Text)
sftp1.GetCurrentPath
End Sub
Sub sftp1_CommandCompleted(Command As String, Success As Boolean, Reply As String)
Log(Success)
If Success Then
'ToastMessageShow(Command,False)
'ToastMessageShow(Reply,False)
Else
Log(LastException.Message)
End If
End Sub
Sub sftp1_ListCompleted (ServerPath As String, Success As Boolean, Folders() As SFtpEntry, Files() As SFtpEntry)
If Success=True Then
ToastMessageShow("success !",False)
Else
'ToastMessageShow("Error : " & LastException.Message,True)
Log(LastException.Message)
End If
End Sub
Sub btnReadCSV_Click
PTFILES.ReadCsvFile
DB.UpdateDailyPatterns
End Sub
Sub btnFlushData_Click
DB.flushdata
End Sub
Sub btnCompare_Click
DB.CompareDailyPatterns
End Sub
Sub btnSendSms_Click
DB.GetSmsToSend
End Sub