#Region Project Attributes
#ApplicationLabel: HTTP Login
#VersionCode: 1
#VersionName:
'SupportedOrientations possible values: unspecified, landscape or portrait.
#SupportedOrientations: portrait
#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.
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 btnLogin As Button
Private Label1 As Label
Private Label2 As Label
Private Label3 As Label
Private Panel1 As Panel
Private txtPassword As EditText
Private txtUserID As EditText
End Sub
Sub Activity_Create(FirstTime As Boolean)
Activity.LoadLayout("frmlogin")
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
Sub btnLogin_Click
Dim strUsername As String = txtUserID.Text.Trim
If strUsername = "" Then
Msgbox("Please enter User ID", "Error")
Return
End If
Dim strPassword As String = txtPassword.Text.Trim
If strPassword = "" Then
Msgbox("Please enter Password", "Error")
Return
End If
Dim job1 As HttpJob
job1.Initialize("Login", Me)
job1.Download2("http://kbase.herobo.com/login.php", _
Array As String("user_id",strUsername,"password",strPassword))
ProgressDialogShow("Connecting to server...")
End Sub
Sub JobDone (Job As HttpJob)
ProgressDialogHide
Log("JobName = " & Job.JobName & ", Success = " & Job.Success)
If Job.Success = True Then
Dim strReturn As String
Log(Job.GetString)
strReturn = Job.GetString
Label3.Text = strReturn
Else
Log("Error: " & Job.ErrorMessage)
ToastMessageShow("Error: " & Job.ErrorMessage, True)
End If
Job.Release
End Sub