/*
         * This is the main delegate method Anyline uses to report its results
         */
        public void DidFindScanResult(AnylineMRZModuleView anylineMRZModuleView, ALIdentification scanResult, bool allCheckDigitsValid, UIImage image)
        {
            // Because there is a lot of information to be passed along the module
            // uses ALIdentification.
            idView.UpdateIdentification(scanResult);

            // Present the information to the user
            AnimateFadeIn();
        }
        public override void ViewDidDisappear(bool animated)
        {
            base.ViewDidDisappear(animated);

            //remove identification view
            idView.RemoveFromSuperview();
            idView.Dispose();
            idView = null;

            //we have to erase the scan view so that there are no dependencies for the viewcontroller left.
            anylineMrzView.RemoveFromSuperview();
            anylineMrzView.Dispose();
            anylineMrzView = null;

            base.Dispose();
        }
Ejemplo n.º 3
0
        /*
         * This is the main delegate method Anyline uses to report its results
         */
        void IAnylineMRZModuleDelegate.DidFindResult(AnylineMRZModuleView anylineMRZModuleView, ALMRZResult scanResult)
        {
            if (_idView == null)
            {
                return;
            }

            // Because there is a lot of information to be passed along the module
            // uses ALIdentification.
            var identification = scanResult.Result as ALIdentification;

            _idView.UpdateIdentification(identification);

            // Present the information to the user
            AnimateFadeIn();
        }
Ejemplo n.º 4
0
        new void Dispose()
        {
            //un-register any event handlers here, if you have any

            //remove identification view
            _idView?.RemoveFromSuperview();
            _idView?.Dispose();
            _idView = null;

            //we have to erase the scan view so that there are no dependencies for the viewcontroller left.
            _anylineMrzView?.RemoveFromSuperview();
            _anylineMrzView?.Dispose();
            _anylineMrzView = null;

            GC.Collect(GC.MaxGeneration);

            base.Dispose();
        }
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            // Initializing the MRZ module.
            CGRect frame = UIScreen.MainScreen.ApplicationFrame;

            frame = new CGRect(frame.X,
                               frame.Y + NavigationController.NavigationBar.Frame.Size.Height,
                               frame.Width,
                               frame.Height - NavigationController.NavigationBar.Frame.Size.Height);

            anylineMrzView = new AnylineMRZModuleView(frame);

            error = null;
            // We tell the module to bootstrap itself with the license key and delegate. The delegate will later get called
            // by the module once we start receiving results.
            success = anylineMrzView.SetupWithLicenseKey(licenseKey, this.Self, out error);
            // SetupWithLicenseKey:delegate:error returns true if everything went fine. In the case something wrong
            // we have to check the error object for the error message.
            if (!success)
            {
                // Something went wrong. The error object contains the error description
                (alert = new UIAlertView("Error", error.DebugDescription, null, "OK", null)).Show();
            }

            //we'll manually cancel scanning
            anylineMrzView.CancelOnResult = false;

            // After setup is complete we add the module to the view of this view controller
            View.AddSubview(anylineMrzView);

            /*
             * ALIdentificationView will present the scanned values. Here we start listening for taps
             * to later dismiss the view.
             */
            idView = new AnylineIdentificationView(new CGRect(0, 0, 300, 300 / 1.4f));
            idView.AddGestureRecognizer(new UITapGestureRecognizer(this, new ObjCRuntime.Selector("ViewTapSelector:")));

            idView.Center = View.Center;
            idView.Alpha  = 0;

            View.AddSubview(idView);
        }