#Region Project Attributes
#ApplicationLabel: MyConnectDB
#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 reqManager As DBRequestManager
'Alamat IP Server RDC-nya
Dim RDCServer As String = "http://l92.168.43.185:17178"
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 Table1 As Table
Dim PnlTable As Panel
End Sub
Sub Activity_Create(FirstTime As Boolean)
'Do not forget to load the layout file created with the visual designer. For example:
'Set judul untuk activity ini.
Activity.Title = "List Barang"
'Tambahkan menu.
Activity.AddMenuItem("Sync data Barang","SyncBarang")
'Initialize Panel.
PnlTable.Initialize("")
'Tampilkan Panel di activity ini.
Activity.AddView(PnlTable, 0,0,100%x,100%y)
'Initialize Table.
Table1.Initialize(Me, "Table1", 4, Gravity.CENTER_HORIZONTAL, True)
Table1.CellAlignment = Bit.Or(Gravity.LEFT, Gravity.CENTER_VERTICAL)
Table1.HeaderColor = Colors.Blue
Table1.HeaderTextColor = Colors.Yellow
Table1.TextColor = Colors.Blue
Table1.TableColor = Colors.Red
Table1.AddToActivity(PnlTable, 0, 0, PnlTable.Width, PnlTable.Height)
If FirstTime Then
'Initialize RDC-nya.
reqManager.Initialize(Me, RDCServer)
End If
End Sub
Sub Activity_Resume
End Sub
Sub Activity_Pause (UserClosed As Boolean)
End Sub
Sub SyncBarang_Click()
ProgressDialogShow2("Loading data from server. Please wait...", False)
GetDataBarang("TV")
End Sub
Sub GetDataBarang(keterangan As String)
Dim cmd As DBCommand
cmd.Initialize
cmd.Name = "select_barang"
cmd.Parameters = Array As Object(keterangan)
reqManager.ExecuteQuery(cmd, 0, Null)
End Sub
Sub JobDone(Job As HttpJob)
If Job.Success = False Then
Log("Error: " & Job.ErrorMessage)
Msgbox (Job.ErrorMessage, "Job Error")
ProgressDialogHide
Else
If Job.JobName = "DBRequest" Then
Dim result As DBResult = reqManager.HandleJob(Job)
'Tampilkan data ke dalam bentuk Table.
Table1.LoadRDCResult(result, True)
ProgressDialogHide
End If
End If
Job.Release
End Sub