Sub Activity_Create(FirstTime As Boolean)
'Do not forget to load the layout file created with the visual designer. For example:
Dim HoraCierre As TimeDialog
Activity.LoadLayout("Inicio")
Activity.Title = "Galgo BUS"
MainRecorrido = ""
MainRuta = File.DirRootExternal
If FirstTime Then
OnLineOK = False
End If
If File.Exists(MainRuta,"Galgo.s3db") = False Then
Msgbox("Se copia","Copiando...")
File.Copy(File.DirAssets,"Galgo.s3db",MainRuta,"Galgo.s3db")
End If
DBMain.Initialize(MainRuta,"Galgo.s3db",False)
CurMain = DBMain.ExecQuery("Select * from Param")
If CurMain.RowCount > 0 Then
CurMain.Position = 0
MainId = CurMain.GetInt("Maquina")
MainPatente = CurMain.GetString("Patente")
MainChofer = CurMain.GetString("Chofer")
Else
Msgbox("Debe ingresar los parametros de la Maquina","Apertura")
End If
'Initialise the HttpJob to Check the server.
Job1.Initialize("Job1",Me)
'Do the Http Request.
Job1.Download2("http://api.exg.me/api/Jobs",Array As String("passkey","10897"))
HoraCierre.Is24Hours = True
DateTime.TimeFormat="HH:MM:SS"
Dclock.Initialize("Dclock")
Activity.AddView(Dclock, 100dip, 5dip, 400dip, 100dip)
Dclock.Color = Colors.Gray
Dclock.TextColor = Colors.White
Dclock.TextSize = 60dip
Dclock.Gravity = Gravity.CENTER
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
Sub btnRuta_Click
StartActivity("Ruta")
End Sub
Sub btnParam_Click
StartActivity("Param")
End Sub
Sub JobDone (Job As HttpJob)
Log("JobName = " & Job.JobName & ", Success = " & Job.Success)
If Job.Success = True Then
Select Job.JobName
Case "Job1"
If Job.GetString.Contains("10897") Then
dbM.Initialize("MySQL","xxx.xxx.xxx.xxx","xxxx","xx","Galgo")
Else
Msgbox("No tiene Conexion a Internet","Galbus")
End If
End Select
Else
Msgbox("Problemas para conectar al servidor","Galbus")
End If
End Sub