#Region Project Attributes
#ApplicationLabel: cityFortis
#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 FTP As FTP
Type t_connections (DatabaseType As Int, _
DataSource As String, _
Catalog As String, _
Provider As String, _
ConnType As String, _
WebServisUrl As String, _
UserName As String, _
Password As String, _
Name As String)
Dim connections(16) As t_connections
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.
End Sub
Sub Activity_Create(FirstTime As Boolean)
If FirstTime Then
FTP.Initialize("FTP", "XXXX", 21, "XXXX", "XXXX")
FTP.DownloadFile("/NF_UPDATE/mobilconnections.xml", False, File.DirDefaultExternal, "connections.xml")
End If
'Do not forget to load the layout file created with the visual designer. For example:
'Activity.LoadLayout("lyLogin")
End Sub
Sub FTP_DownloadCompleted (ServerPath As String, Success As Boolean)
If Success = True Then
'Dim bufstr As String
'bufstr=File.ReadString(File.DirDefaultExternal, "connections.xml")
Dim XOMBuilder1 As XOMBuilder
XOMBuilder1.Initialize("XOMBuilder1")
'XOMBuilder1.BuildFromString(bufstr, "", Null)
XOMBuilder1.BuildFromFile(File.DirDefaultExternal & "/connections.xml",Null)
End If
End Sub
Sub XOMBuilder1_BuildDone(XOMDocument1 As XOMDocument, Tag As Object)
If XOMDocument1=Null Then
' XOMDocument1 will be Null if an error has occurred
Log("An error has occured and the XOMDocument has NOT been created")
Log(LastException)
Else
Log("XOMDocument is NOT Null")
Dim RootElement As XOMElement
Dim ConnectionElements As XOMElements
Dim ConnectionValues As XOMElements
RootElement=XOMDocument1.RootElement
ConnectionElements=RootElement.GetChildElements
For i=0 To ConnectionElements.Size-1
ConnectionValues = ConnectionElements.GetElement(i).GetChildElements
For j=0 To ConnectionValues.Size-1
Select Case ConnectionValues.GetElement(j).LocalName
Case "DatabaseType"
connections(i).DatabaseType=ConnectionValues.GetElement(j).Value
Case "DataSource"
connections(i).DataSource=ConnectionValues.GetElement(j).Value
Case "Catalog"
connections(i).Catalog=ConnectionValues.GetElement(j).Value
Case "Provider"
connections(i).Provider =ConnectionValues.GetElement(j).Value
Case "ConnType"
connections(i).ConnType=ConnectionValues.GetElement(j).Value
Case "WebServisUrl"
connections(i).WebServisUrl=ConnectionValues.GetElement(j).Value
Case "UserName"
connections(i).UserName=ConnectionValues.GetElement(j).Value
Case "Password"
connections(i).Password=ConnectionValues.GetElement(j).Value
Case "Name"
connections(i).name=ConnectionValues.GetElement(j).Value
Log(connections(i).name)
End Select
Next
Next
Activity.LoadLayout("lyLogin")
End If
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub