Ejemplo n.º 1
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            // Initializing the Bottlecap scan 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);

            _scanView = new AnylineDocumentModuleView(frame);

            // 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.
            _error   = null;
            _success = _scanView.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();
            }

            //stop scanning on result
            _scanView.CancelOnResult = true;

            // to set certain supported ratios, they can be provided as follows:
            //NSNumber[] ratios = { DocumentRatio.BusinessCardLandscape, DocumentRatio.DINAXLandscape };
            //_scanView.SetDocumentRatios(ratios);

            // you can set the max output resolution of your image here so it will be scaled to a desired size
            //_scanView.MaxOutputResolution = new CGSize(width, height);

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

            // This view notifies the user of any problems that occur while scanning
            _notificationView                = new NotificationView(new CGRect(20, 115, View.Bounds.Width - 40, 30));
            _notificationView.FillColor      = new UIColor((nfloat)(98.0 / 255.0), (nfloat)(39.0 / 255.0), (nfloat)(232.0 / 255.0), (nfloat)(0.6)).CGColor;
            _notificationView.TextLabel.Text = "";
            _notificationView.Alpha          = 0;
            View.Add(_notificationView);
        }
Ejemplo n.º 2
0
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            // Initializing the Bottlecap scan 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);

            scanView = new AnylineDocumentModuleView(frame);

            // 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.
            error   = null;
            success = scanView.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();
            }

            //stop scanning on result
            scanView.CancelOnResult = true;

            scanView.TranslatesAutoresizingMaskIntoConstraints = false;

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

            // This view notifies the user of any problems that occur while scanning
            notificationView                = new NotificationView(new CGRect(20, 115, View.Bounds.Width - 40, 30));
            notificationView.fillColor      = new UIColor((nfloat)(98.0 / 255.0), (nfloat)(39.0 / 255.0), (nfloat)(232.0 / 255.0), (nfloat)(0.6)).CGColor;
            notificationView.textLabel.Text = "";
            notificationView.Alpha          = 0;
            View.Add(notificationView);
        }