1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556 |
- 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>() { 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();
- }
- }
- }
|