void OnBarcodeButtonClick(object sender, EventArgs e)
        {
            var button = (ScannerButton)sender;

            if (button.Data.Code == ListItemCode.ScannerBarcode)
            {
                var configuration = SBSDKUIMachineCodeScannerConfiguration.DefaultConfiguration;
                var controller    = SBSDKUIBarcodeScannerViewController
                                    .CreateNewWithAcceptedMachineCodeTypes(
                    SBSDKBarcodeType.AllTypes, configuration, Delegates.Barcode);
                controller.ModalPresentationStyle = UIModalPresentationStyle.FullScreen;
                PresentViewController(controller, false, null);
            }
            else if (button.Data.Code == ListItemCode.ScannerBatchBarcode)
            {
                var configuration = SBSDKUIBarcodesBatchScannerConfiguration.DefaultConfiguration;
                var controller    = SBSDKUIBarcodesBatchScannerViewController
                                    .CreateNewWithAcceptedMachineCodeTypes(
                    SBSDKBarcodeType.AllTypes, configuration, Delegates.BatchBarcode
                    );
                controller.ModalPresentationStyle = UIModalPresentationStyle.FullScreen;
                PresentViewController(controller, false, null);
            }
            else if (button.Data.Code == ListItemCode.ScannerImportBarcode)
            {
                ImagePicker.Instance.Present(this);
                ImagePicker.Instance.Controller.FinishedPickingMedia += BarcodeImported;
            }
        }
Beispiel #2
0
        private void OnDataButtonClick(object sender, EventArgs e)
        {
            if (!SBSDK.IsLicenseValid())
            {
                ContentView.LayoutSubviews();
                return;
            }

            var button = (ScannerButton)sender;

            if (button.Data.Code == ListItemCode.ScannerMRZ)
            {
                var config = SBSDKUIMachineCodeScannerConfiguration.DefaultConfiguration;
                config.TextConfiguration.CancelButtonTitle = "Done";
                //config.TextConfiguration.FinderTextHint = "Custom finder text ..."
                // see further customization configs

                var viewSize    = View.Frame.Size;
                var targetWidth = viewSize.Width - ((viewSize.Width * 0.058) * 2);
                var aspect      = new SBSDKAspectRatio(targetWidth, targetWidth * 0.3);
                config.UiConfiguration.FinderAspectRatio = aspect;
                var controller = SBSDKUIMRZScannerViewController
                                 .CreateNewWithConfiguration(config, Delegates.MRZ);
                PresentViewController(controller, true, null);
            }
            else if (button.Data.Code == ListItemCode.WorkflowDC)
            {
                var ratios = new SBSDKAspectRatio[]
                {
                    // DC form A5 portrait (e.g. white sheet, AUB Muster 1b/E (1/2018))
                    new SBSDKAspectRatio(148.0, 210.0),
                    // DC form A6 landscape (e.g. yellow sheet, AUB Muster 1b (1.2018))
                    new SBSDKAspectRatio(148.0, 105.0)
                };

                var title = "Please align the DC form in the frame.";
                var name  = "DisabilityCertificateFlow";

                var steps = new SBSDKUIWorkflowStep[]
                {
                    new SBSDKUIScanDisabilityCertificateWorkflowStep(
                        title, "", ratios, true, WorkflowStepValidator.OnDCFormStep
                        )
                };

                PresentController(name, steps);
            }
            else if (button.Data.Code == ListItemCode.WorkflowMRZImage)
            {
                var title = "Please align the Machine readable card with the form in the frame";
                var name  = "MRZScanFlow";

                var steps = new SBSDKUIWorkflowStep[]
                {
                    new SBSDKUIScanMachineReadableZoneWorkflowStep(
                        title, "", MRZRatios, true, WorkflowStepValidator.OnIDCardBackStep
                        )
                };

                PresentController(name, steps);
            }
            else if (button.Data.Code == ListItemCode.WorkflowMRZFrontBack)
            {
                var name = "MRZBackFrontScanFlow";

                var steps = new SBSDKUIWorkflowStep[]
                {
                    new SBSDKUIWorkflowStep(
                        "Step 1/2", "Please scan the front side of your ID card",
                        MRZRatios, true, false, null, WorkflowStepValidator.OnIDCardFrontStep
                        ),
                    new SBSDKUIScanMachineReadableZoneWorkflowStep(
                        "Step 2/2", "Please scan the back side of your ID card",
                        MRZRatios, true, WorkflowStepValidator.OnIDCardBackStep
                        )
                };

                PresentController(name, steps);
            }
            else if (button.Data.Code == ListItemCode.WorkflowSEPA)
            {
                var name  = "SEPAScanFlow";
                var steps = new SBSDKUIWorkflowStep[]
                {
                    new SBSDKUIScanPayFormWorkflowStep(
                        "Please scan a SEPA PayForm", "", false, WorkflowStepValidator.OnPayFormStep
                        )
                };

                PresentController(name, steps);
            }
            else if (button.Data.Code == ListItemCode.WorkflowQR)
            {
                var name  = "QRCodeScanFlow";
                var types = SBSDKUIMachineCodesCollection.TwoDimensionalBarcodes;
                var steps = new SBSDKUIWorkflowStep[]
                {
                    new SBSDKUIScanBarCodeWorkflowStep("Scan your QR code", "",
                                                       types, new SBSDKAspectRatio(1, 1), WorkflowStepValidator.OnBarCodeStep)
                };

                PresentController(name, steps);
            }
            else if (button.Data.Code == ListItemCode.ScannerEHIC)
            {
                var configuration = SBSDKUIHealthInsuranceCardScannerConfiguration.DefaultConfiguration;
                var controller    = SBSDKUIHealthInsuranceCardScannerViewController
                                    .CreateNewWithConfiguration(configuration, Delegates.EHIC);

                controller.ModalPresentationStyle = UIModalPresentationStyle.FullScreen;
                PresentViewController(controller, false, null);
            }
            else if (button.Data.Code == ListItemCode.ScannerBarcode)
            {
                var configuration = SBSDKUIMachineCodeScannerConfiguration.DefaultConfiguration;
                var controller    = SBSDKUIBarcodeScannerViewController
                                    .CreateNewWithAcceptedMachineCodeTypes(
                    SBSDKBarcodeType.AllTypes, configuration, Delegates.Barcode);
                controller.ModalPresentationStyle = UIModalPresentationStyle.FullScreen;
                PresentViewController(controller, false, null);
            }
        }