public override void ViewDidLoad() { base.ViewDidLoad(); DataCaptureManager.Instance.InitializeAndStartScanning(); // To visualize the on-going capturing process on screen, setup a data capture view // that renders the camera preview. The view must be connected to the data capture context. this.dataCaptureView = DataCaptureView.Create(DataCaptureManager.Instance.DataCaptureContext, this.View.Bounds); this.dataCaptureView.AutoresizingMask = UIViewAutoresizing.FlexibleHeight | UIViewAutoresizing.FlexibleWidth; this.captureOverlay = IdCaptureOverlay.Create(DataCaptureManager.Instance.IdCapture, this.dataCaptureView); this.captureOverlay.IdLayoutStyle = IdLayoutStyle.Square; this.View.AddSubview(this.dataCaptureView); }
protected override void OnCreate(Bundle savedInstanceState) { base.OnCreate(savedInstanceState); this.SetContentView(Resource.Layout.activity_main); Toolbar toolbar = this.FindViewById <Toolbar>(Resource.Id.toolbar); this.SetSupportActionBar(toolbar); this.SupportActionBar.SetDisplayHomeAsUpEnabled(true); ViewGroup container = this.FindViewById <ViewGroup>(Resource.Id.data_capture_view_container); // Create a new DataCaptureView and fill the screen with it. DataCaptureView will show // the camera preview on the screen. Pass your DataCaptureContext to the DataCaptureView. this.view = DataCaptureView.Create(this, DataCaptureManager.Instance.DataCaptureContext); container.AddView(view, new Android.Widget.FrameLayout.LayoutParams(ViewGroup.LayoutParams.MatchParent, ViewGroup.LayoutParams.MatchParent)); this.overlay = IdCaptureOverlay.Create(DataCaptureManager.Instance.IdCapture, this.view); this.overlay.IdLayoutStyle = IdLayoutStyle.Square; }