private void CaptureThread() { variables.reset = false; while (!variables.reset) { Fid fid = null; if (variables.currentReader == null) { variables.currentReader = device.IndexDevice(); device.InitializeDevice(ref variables.currentReader); } if (!CaptureFinger(ref fid)) { //break; } if (fid == null) { continue; } foreach (Fid.Fiv fiv in fid.Views) { SendMessage(CreateBitmap(fiv.RawImage, fiv.Width, fiv.Height)); } } if (variables.currentReader != null) { variables.currentReader.Dispose(); } }
private IEnumerable <Fmd> CaptureAndExtractFmd() { while (!objVariables.reset) { DataResult <Fmd> resultConversion; try { if (objVariables.count >= 8) { MessageBox.Show("El registro no se completó, vuelve a intentarlo.", "Aviso", MessageBoxButtons.OK, MessageBoxIcon.Exclamation, MessageBoxDefaultButton.Button1); objVariables.count = 0; break; } Fid fid = null; if (objVariables.currentReader == null) { objVariables.currentReader = objDevice.IndexDevice(); objDevice.InitializeDevice(ref objVariables.currentReader); } if (!CaptureFinger(ref fid)) { //break; } if (fid == null) { continue; } objVariables.count++; resultConversion = FeatureExtraction.CreateFmdFromFid(fid, Constants.Formats.Fmd.ANSI); objPrincipal.txtSalida.Dispatcher.BeginInvoke(new Action(delegate() { objPrincipal.txtSalida.AppendText("\nLa huella se ha capturado. Captura Numero: " + objVariables.count); })); if (resultConversion.ResultCode != Constants.ResultCode.DP_SUCCESS) { break; } } catch (Exception) { break; } yield return(resultConversion.Data); } }
private void IdentifyThread() { while (!reset) { Fid fid = null; if (!CaptureFinger(ref fid)) { //break; } if (objReader == null) { objReader = objDeviceReader.IndexDevice(); objDeviceReader.InitializeDevice(ref objReader); } if (fid == null) { continue; } DataResult <Fmd> resultConversion = FeatureExtraction.CreateFmdFromFid(fid, Constants.Formats.Fmd.ANSI); if (resultConversion.ResultCode != Constants.ResultCode.DP_SUCCESS) { //break; if (objReader != null) { objReader.Dispose(); objReader = null; } return; } int thresholdScore = DPFJ_PROBABILITY_ONE * 1 / 100000; Fmd aux = resultConversion.Data; Fmd temp; foreach (Clases.Persona item in listPersons) { try { temp = Fmd.DeserializeXml(item.huella); CompareResult identifyResult = Comparison.Compare(aux, 0, temp, 0); if (identifyResult.ResultCode != Constants.ResultCode.DP_SUCCESS) { break; } var responseString = ""; if (identifyResult.Score < thresholdScore) { //guardar la asistencia en la base de datos try { using (var client = new WebClient()) { DateTime checada = DateTime.Now; var values = new NameValueCollection(); values["cuenta"] = item.id; values["evento"] = _evento; values["checada"] = checada.ToString("yyyy-MM-dd H:mm:ss"); var response = client.UploadValues("http://facite.uas.edu.mx/agenda/registrar_checada.php", values); responseString = Encoding.Default.GetString(response); } } catch (Exception err) { MessageBox.Show(err.Message); } SendMessage(responseString, item.Nombre, "Se registró a las " + DateTime.Now.ToShortTimeString(), "", "", ""); Thread.Sleep(3000); SendMessage("Coloque el dedo en el checador...", "", "", "", "", ""); menuPrincipal.Dispatcher.BeginInvoke(new Action(delegate() { menuPrincipal.lbl_fechas.Content = ""; menuPrincipal.lbl_resto.Content = ""; })); break; } else { //SendMessage("No se encuentra registrada la huella", "", "", "","",""); // Thread.Sleep(2000); SendMessage("Coloque el dedo en el checador...", "", "", "", "", ""); menuPrincipal.Dispatcher.BeginInvoke(new Action(delegate() { menuPrincipal.lbl_fechas.Content = ""; menuPrincipal.lbl_resto.Content = ""; })); //break; } } catch (Exception error) { MessageBox.Show(error.Message); } } } if (objReader != null) { objReader.Dispose(); } }