Exemplo n.º 1
0
        protected override void OnCreate(Bundle bundle)
        {
            Window.SetFlags(WindowManagerFlags.KeepScreenOn, WindowManagerFlags.KeepScreenOn);

            base.OnCreate(bundle);

            ActionBar.SetHomeButtonEnabled(true);
            ActionBar.SetDisplayHomeAsUpEnabled(true);

            SetContentView(Resource.Layout.MrzActivity);

            SetTitle(Resource.String.scan_mrz);

            _scanView   = FindViewById <MrzScanView>(Resource.Id.mrz_scan_view);
            _resultView = FindViewById <MrzResultView>(Resource.Id.mrz_result);

            _resultView.SetOnClickListener(this);

            _scanView.SetConfigFromAsset("MrzConfig.json");

            _scanView.InitAnyline(MainActivity.LicenseKey, this);

            _scanView.SetCancelOnResult(true);

            _scanView.CameraOpened += (s, e) =>
            {
                Log.Debug(TAG, "Camera opened successfully. Frame resolution " + e.Width + " x " + e.Height);
                _resultView.Visibility = ViewStates.Invisible;
                _scanView.StartScanning();
            };

            _scanView.CameraError += (s, e) => { Log.Error(TAG, "OnCameraError: " + e.Event.Message); };
        }