#Region Project Attributes
#ApplicationLabel: mobi Pedido
#VersionCode: 1
#VersionName:
'SupportedOrientations possible values: unspecified, landscape or portrait.
#SupportedOrientations: portrait
#CanInstallToExternalStorage: True
#End Region
#Region Activity Attributes
#FullScreen: True
#IncludeTitle: False
#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.
Dim WebView1 As WebView
Dim WebAddress As String
Private btnFechar 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:
WebAddress = "http://app.mobipedido.com.br/mobipedido.dll/m?telefone=5123456789"
'WebAddress = "http://192.168.15.14:8080/m?telefone=5123456789"
ProgressDialogShow2("C o n e c t a n d o Aguarde...",True)
check_http
End Sub
Sub check_http
Dim job1 As HttpJob
job1.Initialize("Job1", Me)
'Send a GET request
job1.Download(WebAddress)
End Sub
Sub JobDone (job As HttpJob)
Log("JobName = " & job.JobName & ", Success = " & job.Success)
If job.Success = False Then
Log("Error: " & job.ErrorMessage)
'do something else
ProgressDialogHide
Activity.LoadLayout("weberror")
Else
Log(job.GetString)
'do something if ok
Activity.LoadLayout("webnav")
WebView1.LoadUrl(WebAddress)
End If
job.Release
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
Sub Activity_KeyPress (KeyCode As Int) As Boolean 'Return True to consume the event
If KeyCode = KeyCodes.KEYCODE_BACK Then
Dim I As Int
i = Msgbox2("Tem certeza que deseja sair do aplicativo?", "Sair do aplicativo", "SIM", "NÃO", "", Null)
If i = DialogResponse.POSITIVE Then Return False
If i = DialogResponse.NEGATIVE Then Return True
Return True
End If
End Sub
Sub WebView1_PageFinished (Url As String)
ProgressDialogHide
End Sub
Sub btnFechar_Click
Activity.Finish
End Sub