| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960 |
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- using Xamarin.Essentials;
- using Xamarin.Forms;
- using Xamarin.Forms.Xaml;
- using XF.Material.Forms.UI.Dialogs;
- using ZXing;
- namespace PRS.Mobile
- {
- [XamlCompilation(XamlCompilationOptions.Compile)]
- public partial class FrameScannerDetails
- {
- public FrameScannerDetails()
- {
- InitializeComponent();
-
- 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;
- }
- public bool IsScanning
- {
- get => _scanView.IsAnalyzing;
- set => _scanView.IsAnalyzing = value;
- }
- public override void Refresh()
- {
- }
-
- private bool bProcessing = false;
- private async void ScanView_OnScanResult(Result result)
- {
- if (bProcessing)
- return;
- bProcessing = true;
- Vibration.Vibrate();
- using(var dialog = await MaterialDialog.Instance.LoadingDialogAsync(message: "Working"))
- {
- var task = Task.Run(() => ViewModel.Search(result.Text));
- task.Wait();
- }
- bProcessing = false;
- }
- }
- }
|