private void btnClose_Click(object sender, EventArgs e) { if (capturing) { try { FPCore.StopCapture(Sensor); capturing = false; } catch (FingerprintException ex) { MessageBox.Show(String.Format("StopCapture Error : {0} {1}", ex.ErrorCode, ex.Message), "FPLibrary Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } if (CloseOnCapture) { this.DialogResult = DialogResult.Cancel; } else if (CaptureMultiple && CapturedFingers.Count > 0) { this.DialogResult = DialogResult.OK; } else { this.DialogResult = DialogResult.Cancel; } this.Close(); }
private void DisplayImage(FingerprintTemplate template, FingerprintRawImage rawImage) { IntPtr hdc = FingerprintCore.GetDC(); IntPtr image = new IntPtr(); FPCore.GetBiometricDisplay(template, rawImage, hdc, ref image, FingerprintConstants.GR_NO_CONTEXT); SetBMapImage(Bitmap.FromHbitmap(image)); FingerprintCore.ReleaseDC(hdc); }
void FPCore_onImage(object source, GriauleFingerprintLibrary.Events.ImageEventArgs ie) { try { if (ie.RawImage != null) { SetImage(ie.RawImage.Image); template = new FingerprintTemplate(); int ret = (int)FPCore.Enroll(ie.RawImage, ref template, (GrTemplateFormat)Controller.DefaultTemplateFormat, FingerprintConstants.GR_DEFAULT_CONTEXT); if (ret >= FingerprintConstants.GR_ENROLL_SUFFICIENT) { DisplayImage(template, ie.RawImage); EnableCaptureButton(true); if (ret == FingerprintConstants.GR_ENROLL_SUFFICIENT) { ShowQuality(EnrollQuality.Sufficient); SetFingerLabel("Place finger again to improve quality", true); } else if (ret == FingerprintConstants.GR_ENROLL_GOOD) { ShowQuality(EnrollQuality.Good); SetFingerLabel("Click 'Capture' to record template", true); } else if (ret == FingerprintConstants.GR_ENROLL_VERY_GOOD) { ShowQuality(EnrollQuality.VeryGood); SetFingerLabel("Click 'Capture' to record template", true); } else if (ret == FingerprintConstants.GR_ENROLL_MAX_LIMIT_REACHED) { SetFingerLabel("Enrollment limit reached", true); } } else { SetFingerLabel("Place finger again", true); ShowQuality(EnrollQuality.Poor); } Thread.Sleep(100); } } catch (FingerprintException ex) { ShowFPError(ex); } catch (Exception e) { ShowError(e); } }
/// <summary> /// Clean up any resources being used. /// </summary> /// <param name="disposing">true if managed resources should be disposed; otherwise, false.</param> protected override void Dispose(bool disposing) { if (disposing && (components != null)) { if (capturing) { try { FPCore.StopCapture(Sensor); } catch (FingerprintException ex) { MessageBox.Show(String.Format("StopCapture Error : {0} {1}", ex.ErrorCode, ex.Message), "FPLibrary Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } components.Dispose(); } base.Dispose(disposing); }
private void hands1_FingerFocused(object sender, FingerFocusedEventArgs e) { btnCapture.Enabled = false; if (!capturing) { try { FPCore.StartCapture(Sensor); capturing = true; } catch (FingerprintException ex) { MessageBox.Show(String.Format("StartCapture Error : {0} {1}", ex.ErrorCode, ex.Message), "FPLibrary Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } } switch (e.FocusedFinger) { case Fingers.RightThumb: lblPrompt.Text = "Place right thumb on fingerprint sensor"; picFinger.Image = Properties.Resources.RThumb; break; case Fingers.RightIndex: lblPrompt.Text = "Place right index finger on fingerprint sensor"; picFinger.Image = Properties.Resources.RIndex; break; case Fingers.RightMiddle: lblPrompt.Text = "Place right middle finger on fingerprint sensor"; picFinger.Image = Properties.Resources.RMiddle; break; case Fingers.RightRing: lblPrompt.Text = "Place right ring finger on fingerprint sensor"; picFinger.Image = Properties.Resources.RRing; break; case Fingers.RightLittle: lblPrompt.Text = "Place right little finger on fingerprint sensor"; picFinger.Image = Properties.Resources.RLittle; break; case Fingers.LeftThumb: lblPrompt.Text = "Place left thumb on fingerprint sensor"; picFinger.Image = Properties.Resources.LThumb; break; case Fingers.LeftIndex: lblPrompt.Text = "Place left index finger on fingerprint sensor"; picFinger.Image = Properties.Resources.LIndex; break; case Fingers.LeftMiddle: lblPrompt.Text = "Place left middle finger on fingerprint sensor"; picFinger.Image = Properties.Resources.LMiddle; break; case Fingers.LeftRing: lblPrompt.Text = "Place left ring finger on fingerprint sensor"; picFinger.Image = Properties.Resources.LRing; break; case Fingers.LeftLittle: lblPrompt.Text = "Place left little finger on fingerprint sensor"; picFinger.Image = Properties.Resources.LLittle; break; case Fingers.RightHeel: lblPrompt.Text = "Place right heel on fingerprint sensor"; picFinger.Image = Properties.Resources.RHeel; break; case Fingers.LeftHeel: lblPrompt.Text = "Place left heel on fingerprint sensor"; picFinger.Image = Properties.Resources.LHeel; break; default: lblPrompt.Text = ""; break; } SetFingerLabel("", false); ShowQuality(EnrollQuality.Unspecified); try { FPCore.StartEnroll(); } catch (FingerprintException ex) { MessageBox.Show(String.Format("StartEnroll Error : {0} {1}", ex.ErrorCode, ex.Message), "FPLibrary Error", MessageBoxButtons.OK, MessageBoxIcon.Error); } }