private WinBioIdentity AddEnrollment(WinBioSessionHandle session, int unitId, WinBioBiometricSubType subType) { Log(string.Format("Beginning enrollment of {0}:", subType)); WinBio.EnrollBegin(session, subType, unitId); var code = WinBioErrorCode.MoreData; for (var swipes = 1; code != WinBioErrorCode.Ok; swipes++) { WinBioRejectDetail rejectDetail; code = WinBio.EnrollCapture(session, out rejectDetail); switch (code) { case WinBioErrorCode.MoreData: Log(string.Format("Swipe {0} was good", swipes)); break; case WinBioErrorCode.BadCapture: Log(string.Format("Swipe {0} was bad: {1}", swipes, rejectDetail)); break; case WinBioErrorCode.Ok: Log(string.Format("Enrollment complete with {0} swipes", swipes)); break; default: throw new WinBioException(code, "WinBioEnrollCapture failed"); } } Log(string.Format("Committing enrollment..")); WinBioIdentity identity; var isNewTemplate = WinBio.EnrollCommit(session, out identity); Log(string.Format(isNewTemplate ? "New template committed." : "Template already existing.")); return(identity); }
private WinBioIdentity AddEnrollment(WinBioSessionHandle session, int unitId, WinBioBiometricSubType subType) { WriteLog(string.Format("Beginning enrollment of {0}:", subType)); WinBio.EnrollBegin(session, subType, unitId); var code = WinBioErrorCode.MoreData; WinBioRejectDetail rejectDetail; int good = 0; for (var swipes = 1; code != WinBioErrorCode.Ok; swipes++) { code = WinBio.EnrollCapture(session, out rejectDetail); switch (code) { case WinBioErrorCode.MoreData: WriteLog(string.Format("Swipe {0} was good", swipes)); good++; break; case WinBioErrorCode.BadCapture: WriteLog(string.Format("Swipe {0} was bad: {1}", swipes, rejectDetail)); break; case WinBioErrorCode.Ok: WriteLog(string.Format("Enrollment complete with {0} swipes", swipes)); break; default: throw new WinBioException(code, "WinBioEnrollCapture failed"); } Progress(good); } WriteLog("Committing enrollment.."); bool isNewTemplate; WinBioIdentity identity = null; try { isNewTemplate = WinBio.EnrollCommit(session, out identity); WriteLog(isNewTemplate ? "New template committed." : "Template already existing."); if (!isNewTemplate) { WinBio.Identify(session, out identity, out subType, out rejectDetail); } EnableDisableOk(true); } catch (Exception e) { WriteLog("Error on AddEnrollment. Error:" + e.Message); } return(identity); }
private void IdentifyTheKeyLED_Click(object sender, EventArgs e) { ThreadPool.QueueUserWorkItem(delegate { try { WinBioRejectDetail rejectDetail; Log(string.Format("Please touch session: unit id {0} in flashing", _unitId)); WinBio.EnrollBegin(_session, WinBioBiometricSubType.LhThumb, _unitId); WinBio.EnrollCapture(_session, out rejectDetail); WinBio.EnrollDiscard(_session); Log(string.Format("Done")); } catch (WinBioException ex) { //ignore } }); }