Example #1
0
 public void device_close()
 {
     try
     {
         bIsTimeToDie  = true;
         RegisterCount = 0;
         Thread.Sleep(1000);
         fpInstance.CloseDevice();
         zkfp2.CloseDevice(mDevHandle);
         Console.WriteLine("Device closed ");
     }
     catch (Exception e) { }
 }
Example #2
0
        static public void DisconnectDevice()
        {
            int result = fpInstance.CloseDevice();  // Close the connection

            if (result == zkfp.ZKFP_ERR_OK)
            {
                result = fpInstance.Finalize();   // Clear the resources
                if (result == zkfp.ZKFP_ERR_OK)
                {
                    reset();
                }
            }
        }
Example #3
0
 private void bnClose_Click(object sender, EventArgs e)
 {
     bIsTimeToDie  = true;
     RegisterCount = 0;
     Thread.Sleep(1000);
     fpInstance.CloseDevice();
     bnInit.Enabled     = false;
     bnFree.Enabled     = true;
     bnOpen.Enabled     = true;
     bnClose.Enabled    = false;
     bnEnroll.Enabled   = false;
     bnVerify.Enabled   = false;
     bnIdentify.Enabled = false;
 }
        public void OnDisconnect()
        {
            bIsTimeToDie  = true;
            RegisterCount = 0;
            DisconnectFingerPrintCounter();
            ClearImage();
            Thread.Sleep(1000);
            int result = fpInstance.CloseDevice();

            captureThread.Abort();
            if (result == zkfp.ZKFP_ERR_OK)
            {
                Utilities.EnableControls(false, btnInit, btnClose, btnEnroll, btnVerify, btnIdentify);

                lblDeviceStatus.Text = Disconnected;

                Thread.Sleep(1000);
                result = fpInstance.Finalize();   // CLEAR RESOURCES

                if (result == zkfp.ZKFP_ERR_OK)
                {
                    regTempLen = 0;
                    IsRegister = false;
                    cmbIdx.Items.Clear();
                    Utilities.EnableControls(true, btnInit);
                    Utilities.EnableControls(false, btnClose, btnEnroll, btnVerify, btnIdentify);

                    ReInitializeInstance();

                    DisplayMessage(MessageManager.msg_FP_Disconnected, true);
                }
                else
                {
                    DisplayMessage(MessageManager.msg_FP_FailedToReleaseResources, false);
                }
            }
            else
            {
                string errorMessage = FingerPrintDeviceUtilities.DisplayDeviceErrorByCode(result);
                DisplayMessage(errorMessage, false);
            }
        }