0byt3m1n1
Path:
C:
/
BACKUPS
/
Biometric Backup
/
KELTRON
/
COSEC V14R4.1
/
Setup
/
API Samples
/
VB 6.0
/
[
Home
]
File: Form1.frm
VERSION 5.00 Begin VB.Form Form1 Caption = "Form1" ClientHeight = 7845 ClientLeft = 120 ClientTop = 450 ClientWidth = 11820 LinkTopic = "Form1" ScaleHeight = 7845 ScaleWidth = 11820 StartUpPosition = 3 'Windows Default Begin VB.Frame FrameOptions BorderStyle = 0 'None Height = 435 Left = 180 TabIndex = 10 Top = 720 Width = 9255 Begin VB.OptionButton Option1 Caption = "HTTP" Height = 435 Index = 3 Left = 6840 Style = 1 'Graphical TabIndex = 14 Top = 0 Width = 2235 End Begin VB.OptionButton Option1 Caption = "Event Data" Height = 435 Index = 2 Left = 4560 Style = 1 'Graphical TabIndex = 13 Top = 0 Width = 2235 End Begin VB.OptionButton Option1 Caption = "Assign / Revoke Devices" Height = 435 Index = 1 Left = 2280 Style = 1 'Graphical TabIndex = 12 Top = 0 Width = 2235 End Begin VB.OptionButton Option1 Caption = "User Add/Edit" Height = 435 Index = 0 Left = 0 Style = 1 'Graphical TabIndex = 11 Top = 0 Width = 2235 End End Begin VB.Frame FrameUserAddEdit Caption = "User Add/Edit" Height = 5535 Left = 180 TabIndex = 7 Top = 1440 Width = 4455 Begin VB.VScrollBar VScroll1 Height = 5355 LargeChange = 50 Left = 4080 SmallChange = 50 TabIndex = 16 Top = 120 Width = 315 End Begin Project1.ctlUserAddEdit ctlUserAddEdit1 Height = 10200 Left = -3300 TabIndex = 15 Top = 400 Width = 7155 _ExtentX = 12621 _ExtentY = 17992 End End Begin VB.Frame FrameHTTP Caption = "HTTP" Height = 5055 Left = 7620 TabIndex = 6 Top = 1500 Width = 4095 Begin VB.CommandButton Command3 Caption = "&Clear" Height = 375 Left = 120 TabIndex = 9 Top = 300 Width = 1095 End Begin VB.TextBox txtHttpRequestResponse Height = 4155 Left = 120 Locked = -1 'True MultiLine = -1 'True ScrollBars = 3 'Both TabIndex = 8 Top = 780 Width = 3825 End End Begin VB.Frame FrameEventData Caption = "Event Data" Height = 2175 Left = 4980 TabIndex = 5 Top = 4560 Width = 2535 Begin Project1.ctlUserData ctlUserData1 Height = 3390 Left = 60 TabIndex = 19 Top = 180 Width = 6765 _ExtentX = 11933 _ExtentY = 5980 End End Begin VB.Frame FrameAssignRevoke Caption = "Assign / Revoke Devices" Height = 2295 Left = 4980 TabIndex = 4 Top = 1440 Width = 2355 Begin Project1.ctlAssignRevokeDevice ctlAssignRevokeDevice1 Height = 5760 Left = 120 TabIndex = 18 Top = 180 Width = 5760 _ExtentX = 10160 _ExtentY = 10160 End End Begin VB.CommandButton cmdCheck Caption = "&Check" Height = 375 Left = 5400 TabIndex = 2 Top = 180 Width = 1095 End Begin VB.TextBox txtCosecURL Height = 285 Left = 1680 TabIndex = 1 Text = "Text1" Top = 240 Width = 3615 End Begin VB.Label lblStatusMsg BackColor = &H00FFFFFF& BeginProperty Font Name = "MS Sans Serif" Size = 8.25 Charset = 0 Weight = 700 Underline = 0 'False Italic = 0 'False Strikethrough = 0 'False EndProperty ForeColor = &H000000C0& Height = 195 Left = 120 TabIndex = 17 Top = 7620 Width = 11115 End Begin VB.Label lblServiceStatus Height = 255 Left = 6660 TabIndex = 3 Top = 240 Width = 2175 End Begin VB.Label Label1 Caption = "Cosec Web URL:" Height = 255 Index = 0 Left = 240 TabIndex = 0 Top = 240 Width = 1335 End End Attribute VB_Name = "Form1" Attribute VB_GlobalNameSpace = False Attribute VB_Creatable = False Attribute VB_PredeclaredId = True Attribute VB_Exposed = False Public WithEvents apiHelperObj As apiHelper Attribute apiHelperObj.VB_VarHelpID = -1 Private Sub Command3_Click() txtHttpRequestResponse.Text = "" End Sub Private Sub Form_Load() Set apiHelperObj = New apiHelper apiHelperObj.LoginID = "sa" apiHelperObj.Password = "admin" txtCosecURL.Text = "http://localhost/cosec/api.svc" Option1(0).Value = True FrameUserAddEdit.Enabled = False FrameAssignRevoke.Enabled = False FrameEventData.Enabled = False FrameHTTP.Enabled = False End Sub Private Sub apiHelperObj_HttpOperations(operation As HTTPOperation, Data As String) Dim responsestr As String If (operation = ErrorResponse) Then responsestr = "Error" Else If (operation = Request) Then responsestr = vbCrLf + "Request" Else responsestr = "Response" End If End If txtHttpRequestResponse.Text = txtHttpRequestResponse.Text + responsestr + ": " + Data + vbCrLf End Sub Private Sub cmdCheck_Click() apiHelperObj.BaseAddress = txtCosecURL.Text Dim err As String If (apiHelperObj.Ping(err)) Then ctlUserAddEdit1.Load ctlAssignRevokeDevice1.Load MsgBox "success" Option1(0).Caption = apiHelperObj.strUser + " Add/Edit" FrameUserAddEdit.Caption = apiHelperObj.strUser + " Add/Edit" FrameUserAddEdit.Enabled = True FrameAssignRevoke.Enabled = True FrameEventData.Enabled = True FrameHTTP.Enabled = True Else MsgBox "fail" End If End Sub Private Sub Form_Resize() Dim frametop As Integer Dim workingHeight As Integer frametop = 1200 workingHeight = ((Me.ScaleHeight - frametop) - lblStatusMsg.Height) - 200 lblStatusMsg.Top = frametop + workingHeight + 100 lblStatusMsg.Width = Me.ScaleWidth - 10 FrameOptions.Left = 10 FrameOptions.Top = frametop - FrameOptions.Height FrameHTTP.Top = frametop FrameUserAddEdit.Top = frametop FrameAssignRevoke.Top = frametop FrameEventData.Top = frametop FrameHTTP.Left = 10 FrameUserAddEdit.Left = 10 FrameAssignRevoke.Left = 10 FrameEventData.Left = 10 FrameHTTP.Width = Me.ScaleWidth - 10 FrameUserAddEdit.Width = Me.ScaleWidth - 10 FrameAssignRevoke.Width = Me.ScaleWidth - 10 FrameEventData.Width = Me.ScaleWidth - 10 FrameHTTP.Height = workingHeight FrameUserAddEdit.Height = workingHeight FrameAssignRevoke.Height = workingHeight FrameEventData.Height = workingHeight ctlUserAddEdit1.Top = 400 ctlUserAddEdit1.Left = 120 VScroll1.Top = 200 VScroll1.Left = (FrameUserAddEdit.Width - VScroll1.Width) - 50 VScroll1.Height = (FrameUserAddEdit.Height - VScroll1.Top) - 50 VScroll1.Min = 0 Dim changeVal As Integer changeVal = (FrameUserAddEdit.Height - (ctlUserAddEdit1.Height + ctlUserAddEdit1.Top)) VScroll1.Max = changeVal If (changeVal > 0) Then VScroll1.Visible = False Else VScroll1.SmallChange = Abs(changeVal) / 5 VScroll1.LargeChange = Abs(changeVal) / 5 VScroll1.Visible = True End If txtHttpRequestResponse.Top = 780 txtHttpRequestResponse.Left = 120 txtHttpRequestResponse.Width = (FrameHTTP.Width - txtHttpRequestResponse.Left) - 100 txtHttpRequestResponse.Height = (FrameHTTP.Height - txtHttpRequestResponse.Top) - 100 End Sub Private Sub Option1_Click(index As Integer) FrameUserAddEdit.Visible = False FrameAssignRevoke.Visible = False FrameEventData.Visible = False FrameHTTP.Visible = False Select Case index Case 0 FrameUserAddEdit.Visible = True Case 1 FrameAssignRevoke.Visible = True Case 2 FrameEventData.Visible = True Case 3 FrameHTTP.Visible = True End Select End Sub Private Sub VScroll1_Change() ctlUserAddEdit1.Top = VScroll1.Value + 400 End Sub Public Sub ShowMessage(msg As String, IsSuccess As Boolean) If (IsSuccess) Then lblStatusMsg.ForeColor = Red Else lblStatusMsg.ForeColor = Green End If lblStatusMsg.Caption = msg End Sub Public Sub ClearMessage() lblStatusMsg.Caption = "" End Sub