private void btnConfirm_Click(object sender, EventArgs e) { try { EnableFingerPrintComponent(false); if (fingerSensor.CmdCmosLed(true) == 0) { UpdateStatusMessage("Input your finger on sensor."); if (fingerSensor.CmdCaptureFinger() == 0) { UpdateStatusMessage("Exporting deleted fingerprint data"); if (fingerSensor.CmdGetRawImage() == 0) { UpdateStatusMessage("Succeed export fingerprint data."); pbImage.Image = BBDataConverter.GrayRawToBitmap(fingerSensor.getRawImage(), FingerSensorPacket.SIZE_FP_WIDTH, FingerSensorPacket.SIZE_FP_HEIGHT); UserManager fpm = new UserManager(); MyPerson guest = fpm.Enroll(BBDataConverter.ImageToByte(pbImage.Image), "guest"); MyPerson match = fpm.recognition(guest); if (match != null) { UpdateCompLogMsg("Matched person(" + match.Name + "): " + VerifyUserMatchRate(guest, match)); } else { UpdateCompLogMsg("No matching person found."); } UpdateCompMatchedUser(match); } else { UpdateStatusMessage("Failed export fingerparint data."); } } else { UpdateStatusMessage("Time out or can not delected fingerprint."); } } } catch (Exception ex) { Console.WriteLine(ex.Message); UpdateStatusMessage("Failed export fingerparint data."); } finally { fingerSensor.CmdCmosLed(false); EnableFingerPrintComponent(true); } }
private void btnScan_Click(object sender, EventArgs e) { if (pbFingerPrint.Image != null) { if (MessageBox.Show("지문 정보를 변경하시겠습니까?", "알림", MessageBoxButtons.YesNo) == DialogResult.No) { return; } } try { EnableFingerPrintButton(false); if (fingerSensor.CmdCmosLed(true) == 0) { StatusMessage("Input your finger on sensor."); if (fingerSensor.CmdCaptureFinger() == 0) { StatusMessage("Exporting deleted fingerprint data"); if (fingerSensor.CmdGetRawImage() == 0) { StatusMessage("Succeed export fingerprint data."); Invoke((MethodInvoker) delegate { pbFingerPrint.Image = BBDataConverter.GrayRawToBitmap(fingerSensor.getRawImage(), FingerSensorPacket.SIZE_FP_WIDTH, FingerSensorPacket.SIZE_FP_HEIGHT); }); } else { StatusMessage("Failed export fingerparint data."); } } else { StatusMessage("Time out or can not delected fingerprint."); } } } catch (Exception ex) { Console.WriteLine(ex.Message); StatusMessage("Failed export fingerparint data."); } finally { fingerSensor.CmdCmosLed(false); EnableFingerPrintButton(true); } }