using System; using System.Collections.Generic; using Xamarin.Forms; using ZXing; namespace comal.timesheets { public partial class FrameScannerPage : ContentPage { public FrameScannerPage() { InitializeComponent(); NavigationPage.SetHasNavigationBar(this, false); var options = new ZXing.Mobile.MobileBarcodeScanningOptions() { PossibleFormats = new List() { ZXing.BarcodeFormat.QR_CODE }, AutoRotate = false, TryInverted = true, TryHarder = true, }; _scanView.Options = options; _scanView.IsAnalyzing = false; _scanView.IsScanning = true; } protected override void OnAppearing() { base.OnAppearing(); _scanView.IsAnalyzing = true; } protected override void OnDisappearing() { _scanView.IsAnalyzing = false; base.OnDisappearing(); } void _scanView_OnScanResult(ZXing.Result result) { Device.BeginInvokeOnMainThread(async () => { //var page = new FrameDetailsPage(result.Text); //await Navigation.PushModalAsync(page); //await DisplayAlert("Scanned result", "The barcode's text is " + result.Text + ". The barcode's format is " + result.BarcodeFormat, "OK"); }); } void Cancel_Clicked(System.Object sender, System.EventArgs e) { Navigation.PopModalAsync(); } } }