protected override void DefWndProc(ref Message m) { switch (m.Msg) { case MESSAGE_CAPTURED_OK: { #region casoMach if (textBox1.Text == "") { textBox1.Text = "0"; } int CEDULA = int.Parse(textBox1.Text); // Can be the users unique ID Person = SqliteDataAccess.BuscaCedula(CEDULA); byte[] regTemplate = zkfp.Base64String2Blob(Person[0].HUELLA); int ret2 = fpInstance.Match(CapTmp, regTemplate); // MACH CASE REVISAR ########################### if (0 < ret2) { textBox2.Text = Person[0].NOMBRE; textBox3.Text = Person[0].FECHA_INSC; DisplayFingerPrintImage(); MessageBox.Show("SI HACE MACHT FUNCIONA"); DisplayMessage(MessageManager.msg_FP_machtcase, true); return; } else { MessageBox.Show("NO HACE MACHT"); } #endregion parentForm.statusBar.Visible = false; DisplayFingerPrintImage(); if (IsRegister) { #region -------- IF REGISTERED FINGERPRINT -------- int ret = zkfp.ZKFP_ERR_OK; int fid = 0, score = 0; ret = fpInstance.Identify(CapTmp, ref fid, ref score); if (zkfp.ZKFP_ERR_OK == ret) { int deleteCode = fpInstance.DelRegTemplate(fid); // <---- REMOVE FINGERPRINT if (deleteCode != zkfp.ZKFP_ERR_OK) { DisplayMessage(MessageManager.msg_FP_CurrentFingerAlreadyRegistered + fid, false); return; } } if (RegisterCount > 0 && fpInstance.Match(CapTmp, RegTmps[RegisterCount - 1]) <= 0) { DisplayMessage("Please press the same finger " + REGISTER_FINGER_COUNT + " times for enrollment", true); return; } Array.Copy(CapTmp, RegTmps[RegisterCount], cbCapTmp); if (RegisterCount == 0) { btnEnroll.Enabled = false; } RegisterCount++; if (RegisterCount >= REGISTER_FINGER_COUNT) { RegisterCount = 0; ret = GenerateRegisteredFingerPrint(); // <--- GENERATE FINGERPRINT TEMPLATE if (zkfp.ZKFP_ERR_OK == ret) { ret = AddTemplateToMemory(); // <--- LOAD TEMPLATE TO MEMORY if (zkfp.ZKFP_ERR_OK == ret) // <--- ENROLL SUCCESSFULL { MessageBox.Show(RegTmp.ToString()); string fingerPrintTemplate = string.Empty; zkfp.Blob2Base64String(RegTmp, regTempLen, ref fingerPrintTemplate); Utilities.EnableControls(true, btnVerify, btnIdentify); Utilities.EnableControls(false, btnEnroll); // GET THE TEMPLATE HERE : fingerPrintTemplate string HUELLA = fingerPrintTemplate; int CEDU = int.Parse(textBox1.Text); string NOMBRE = textBox2.Text; int STATUS = 0; string FEHA_INSC = textBox3.Text; string TIPO_INSC = "GF"; SqliteDataAccess.CargaHuella(CEDU, NOMBRE, HUELLA, STATUS, FEHA_INSC, TIPO_INSC); MessageBox.Show("INSCRIPCION EXITOSA!!"); textBox1.Text = ""; textBox2.Text = ""; textBox3.Text = ""; textBox4.Text = ""; checkBox1.Checked = false; DisplayMessage(MessageManager.msg_FP_EnrollSuccessfull, true); DisconnectFingerPrintCounter(); } else { DisplayMessage(MessageManager.msg_FP_FailedToAddTemplate, false); } } else { DisplayMessage(MessageManager.msg_FP_UnableToEnrollCurrentUser + ret, false); } IsRegister = false; return; } else { int remainingCont = REGISTER_FINGER_COUNT - RegisterCount; lblFingerPrintCount.Text = remainingCont.ToString(); string message = "Please provide your fingerprint " + remainingCont + " more time(s)"; DisplayMessage(message, true); } #endregion } else { #region ------- IF RANDOM FINGERPRINT ------- // If unidentified random fingerprint is applied if (regTempLen <= 0) { DisplayMessage(MessageManager.msg_FP_UnidentifiedFingerPrint, false); return; } if (bIdentify) { int ret = zkfp.ZKFP_ERR_OK; int fid = 0, score = 0; ret = fpInstance.Identify(CapTmp, ref fid, ref score); if (zkfp.ZKFP_ERR_OK == ret) { DisplayMessage(MessageManager.msg_FP_IdentificationSuccess + ret, true); return; } else { DisplayMessage(MessageManager.msg_FP_IdentificationFailed + ret, false); return; } } else { int ret = fpInstance.Match(CapTmp, RegTmp); // MACH CASE REVISAR ########################### if (0 < ret) { DisplayMessage(MessageManager.msg_FP_MatchSuccess + ret, true); return; } else { DisplayMessage(MessageManager.msg_FP_MatchFailed + ret, false); return; } } #endregion } } break; default: base.DefWndProc(ref m); break; } }