public override void DocumentOverlayViewControllerDidFinishScanning(MBDocumentOverlayViewController documentOverlayViewController, MBRecognizerResultState state) { // this method is called on background processing thread. The scanning will resume as soon // as this method ends, so in order to have unchanged results at the time of displaying UIAlertView // pause the scanning documentOverlayViewController.RecognizerRunnerViewController.PauseScanning(); var title = "Result"; var message = ""; // each recognizer has Result property which contains recognized data after scanning has been finished // we can check ResultState property of the Result to see if the result contains scanned information if (me.mrtdRecognizer.Result.ResultState == MBRecognizerResultState.Valid) { var mrtdResult = me.mrtdRecognizer.Result; message += "MRTD recognizer result:\n" + "PrimaryID: " + mrtdResult.MrzResult.PrimaryID + "\n" + "SecondaryID: " + mrtdResult.MrzResult.SecondaryID + "\n" + "Date of birth: " + mrtdResult.MrzResult.DateOfBirth.Day + "." + mrtdResult.MrzResult.DateOfBirth.Month + "." + mrtdResult.MrzResult.DateOfBirth.Year + ".\n"; } if (me.eudlRecognizer.Result.ResultState == MBRecognizerResultState.Valid) { var eudlResult = me.eudlRecognizer.Result; message += "EUDL recognizer result:\n" + "First name: " + eudlResult.FirstName + "\n" + "Last name: " + eudlResult.LastName + "\n" + "Birth data: " + eudlResult.BirthData + "\n" + "Country: " + eudlResult.Country.ToString() + "\n"; } if (me.usdlRecognizer.Result.ResultState == MBRecognizerResultState.Valid) { var usdlResult = me.usdlRecognizer.Result; message += "USDL recognizer result:\n" + "First name: " + usdlResult.GetField(MBUsdlKeys.CustomerFirstName) + "\n" + "Last name: " + usdlResult.GetField(MBUsdlKeys.CustomerFamilyName) + "\n" + "City: " + usdlResult.GetField(MBUsdlKeys.AddressCity) + "\n"; } UIApplication.SharedApplication.InvokeOnMainThread(delegate { UIAlertView alert = new UIAlertView() { Title = title, Message = message }; alert.AddButton("OK"); alert.Show(); // after alert dialog is dismissed, you can either resume scanning with // documentOverlayViewController.RecognizerRunnerViewController.ResumeScanningAndResetState(true) // or you can simply dismiss the RecognizerRunnerViewController alert.Dismissed += (sender, e) => me.DismissViewController(true, null); }); }
public override void BlinkIdOverlayViewControllerDidFinishScanning(MBBlinkIdOverlayViewController blinkIdOverlayViewController, MBRecognizerResultState state) { // this method is called on background processing thread. The scanning will resume as soon // as this method ends, so in order to have unchanged results at the time of displaying UIAlertView // pause the scanning blinkIdOverlayViewController.RecognizerRunnerViewController.PauseScanning(); var title = "Result"; var message = ""; // each recognizer has Result property which contains recognized data after scanning has been finished // we can check ResultState property of the Result to see if the result contains scanned information if (me.blinkIdRecognizer.Result.ResultState == MBRecognizerResultState.Valid) { var blinkidResult = me.blinkIdRecognizer.Result; message += "BlinkID recognizer result:\n" + BuildResult(blinkidResult.FirstName, "First name") + BuildResult(blinkidResult.LastName, "Last name") + BuildResult(blinkidResult.FullName, "Full name") + BuildResult(blinkidResult.LocalizedName, "Localized name") + BuildResult(blinkidResult.AdditionalNameInformation, "Additional name info") + BuildResult(blinkidResult.Address, "Address") + BuildResult(blinkidResult.AdditionalAddressInformation, "Additional address info") + BuildResult(blinkidResult.DocumentNumber, "Document number") + BuildResult(blinkidResult.DocumentAdditionalNumber, "Additional document number") + BuildResult(blinkidResult.Sex, "Sex") + BuildResult(blinkidResult.IssuingAuthority, "Issuing authority") + BuildResult(blinkidResult.Nationality, "Nationality") + BuildResult(blinkidResult.DateOfBirth, "DateOfBirth") + BuildResult(blinkidResult.Age, "Age") + BuildResult(blinkidResult.DateOfIssue, "Date of issue") + BuildResult(blinkidResult.DateOfExpiry, "Date of expiry") + BuildResult(blinkidResult.DateOfExpiryPermanent, "Date of expiry permanent") + BuildResult(blinkidResult.MaritalStatus, "Martial status") + BuildResult(blinkidResult.PersonalIdNumber, "Personal Id Number") + BuildResult(blinkidResult.Profession, "Profession") + BuildResult(blinkidResult.Race, "Race") + BuildResult(blinkidResult.Religion, "Religion") + BuildResult(blinkidResult.ResidentialStatus, "Residential Status"); MBDriverLicenseDetailedInfo licenceInfo = blinkidResult.DriverLicenseDetailedInfo; if (licenceInfo != null) { message += BuildResult(licenceInfo.Restrictions, "Restrictions") + BuildResult(licenceInfo.Endorsements, "Endorsements") + BuildResult(licenceInfo.VehicleClass, "Vehicle class") + BuildResult(licenceInfo.Conditions, "Conditions"); } } UIApplication.SharedApplication.InvokeOnMainThread(delegate { UIAlertView alert = new UIAlertView() { Title = title, Message = message }; alert.AddButton("OK"); alert.Show(); // after alert dialog is dismissed, you can either resume scanning with // documentOverlayViewController.RecognizerRunnerViewController.ResumeScanningAndResetState(true) // or you can simply dismiss the RecognizerRunnerViewController alert.Dismissed += (sender, e) => me.DismissViewController(true, null); }); }
public override void BlinkIdOverlayViewControllerDidFinishScanning(MBBlinkIdOverlayViewController blinkIdOverlayViewController, MBRecognizerResultState state) { // this method is called on background processing thread. The scanning will resume as soon // as this method ends, so in order to have unchanged results at the time of displaying UIAlertView // pause the scanning blinkIdOverlayViewController.RecognizerRunnerViewController.PauseScanning(); var title = "Result"; var message = ""; // each recognizer has Result property which contains recognized data after scanning has been finished // we can check ResultState property of the Result to see if the result contains scanned information if (me.blinkIdRecognizer.Result.ResultState == MBRecognizerResultState.Uncertain) { var blinkidResult = me.blinkIdRecognizer.Result; message += "BlinkID recognizer result:\n" + "FirstName: " + blinkidResult.FirstName + "\n" + "LastName: " + blinkidResult.LastName + "\n" + "Address: " + blinkidResult.Address + "\n" + "DocumentNumber: " + blinkidResult.DocumentNumber + "\n" + "Sex: " + blinkidResult.Sex + "\n"; var dob = blinkidResult.DateOfBirth; if (dob != null) { message += "DateOfBirth: " + dob.Day + "." + dob.Month + "." + dob.Year + ".\n"; } var doi = blinkidResult.DateOfIssue; if (doi != null) { message += "DateOfIssue: " + doi.Day + "." + doi.Month + "." + doi.Year + ".\n"; } var doe = blinkidResult.DateOfExpiry; if (doe != null) { message += "DateOfExpiry: " + doe.Day + "." + doe.Month + "." + doe.Year + ".\n"; } } UIApplication.SharedApplication.InvokeOnMainThread(delegate { UIAlertView alert = new UIAlertView() { Title = title, Message = message }; alert.AddButton("OK"); alert.Show(); // after alert dialog is dismissed, you can either resume scanning with // documentOverlayViewController.RecognizerRunnerViewController.ResumeScanningAndResetState(true) // or you can simply dismiss the RecognizerRunnerViewController alert.Dismissed += (sender, e) => me.DismissViewController(true, null); }); }