Exemplo n.º 1
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();
        }
Exemplo n.º 2
0
        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, 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, (IUIAlertViewDelegate)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);
        }