public void Scan(IOverlaySettings overlaySettings)
        {
            this.overlaySettings = overlaySettings;
            var window = UIApplication.SharedApplication.KeyWindow;
            var vc     = window.RootViewController;

            if (overlaySettings is DocumentCaptureOverlaySettings)
            {
                this.documentCaptureRecognizerWrapper = ((DocumentCaptureOverlaySettings)overlaySettings).DocumentCaptureRecognizerWrapper;
            }
            else
            {
                this.documentCaptureRecognizerWrapper = null;
                this.highResImage = null;
            }
            if (overlaySettings is FieldByFieldOverlaySettings)
            {
                this.fieldByFieldCollection = ((FieldByFieldOverlaySettings)overlaySettings).FieldByFieldCollection;
            }
            else
            {
                this.fieldByFieldCollection = null;
            }

            recognizerRunnerViewController = MBViewControllerFactory.RecognizerRunnerViewControllerWithOverlayViewController(((OverlaySettings)overlaySettings).CreateOverlayViewController(this));

            vc.PresentViewController(ObjCRuntime.Runtime.GetINativeObject <UIViewController>(recognizerRunnerViewController.Handle, false), true, null);
        }
Beispiel #2
0
        public void Scan(IOverlaySettings overlaySettings)
        {
            var window = UIApplication.SharedApplication.KeyWindow;
            var vc     = window.RootViewController;

            recognizerRunnerViewController = MBViewControllerFactory.RecognizerRunnerViewControllerWithOverlayViewController(((OverlaySettings)overlaySettings).CreateOverlayViewController(this));

            vc.PresentViewController(ObjCRuntime.Runtime.GetINativeObject <UIViewController>(recognizerRunnerViewController.Handle, false), true, null);
        }
        partial void StartScanningButton_TouchUpInside(UIButton sender)
        {
            // create a collection of recognizers that will be used for scanning
            var recognizerCollection = new MBRecognizerCollection(new MBRecognizer[] { mrtdRecognizer, eudlRecognizer, usdlRecognizer });

            // create a settings object for overlay that will be used. For ID it's best to use DocumentOverlayViewController
            // there are also other overlays available - check iOS documentation
            var documentOverlaySettings = new MBDocumentOverlaySettings();
            var documentOverlay         = new MBDocumentOverlayViewController(documentOverlaySettings, recognizerCollection, customDelegate);

            // finally, create a recognizerRunnerViewController
            var recognizerRunnerViewController = MBViewControllerFactory.RecognizerRunnerViewControllerWithOverlayViewController(documentOverlay);

            // in ObjC recognizerRunnerViewController would actually be of type UIViewController<MBRecognizerRunnerViewController>*, but this construct
            // is not supported in C#, so we need to use Runtime.GetINativeObject to cast obtained IMBReocognizerRunnerViewController into UIViewController
            // that can be presented
            this.PresentViewController(ObjCRuntime.Runtime.GetINativeObject <UIViewController>(recognizerRunnerViewController.Handle, false), true, null);
        }