#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 LabelBC As Label
Private LabelError As Label
Private LabelMarking As Label
End Sub
Sub Activity_Create(FirstTime As Boolean)
'Do not forget to load the layout file created with the visual designer. For example:
Activity.LoadLayout("Marking")
Dim BC As String
BC = Main.ScannedBarcode
Dim Job As HttpJob
Job.Initialize("Job1",Me)
Job.Username="..."
Job.Password="..."
Job.Download("https://xy.xy.com/api/barcode/1?barcode=" & BC & "&customer=kro")
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
Sub JobDone (Job As HttpJob)
Log("JobName = " & Job.JobName & ", Success = " & Job.Success)
If Job.Success = True Then
Select Job.JobName
Case "Job1"
Dim JSON As JSONParser
JSON.Initialize(Job.GetString)
Dim Map1 As Map
Map1 = JSON.NextObject
LabelBC.Text = Map1.Get("barcode")
LabelMarking.Text = Map1.Get("marking")
LabelError.Text = Map1.Get("error")
'print the result to the logs
Log(Job.GetString)
End Select
Else
Log("Error: " & Job.ErrorMessage)
ToastMessageShow("Error: " & Job.ErrorMessage, True)
End If
Job.Release
End Sub