BarcodeScanner

This commit is contained in:
2024-08-20 12:28:28 +02:00
parent 8e1b391f65
commit a1dfd3b1e7
18 changed files with 138 additions and 163 deletions

View File

@@ -1,3 +1,5 @@
using ZXing;
using ZXing.Net.Maui.Controls;
namespace Jugenddienst_Stunden.Views;
public partial class AboutPage : ContentPage
@@ -5,6 +7,22 @@ public partial class AboutPage : ContentPage
public AboutPage()
{
InitializeComponent();
barcodeScannerView.Options = new ZXing.Net.Maui.BarcodeReaderOptions {
Formats = ZXing.Net.Maui.BarcodeFormat.QrCode,
AutoRotate = true,
Multiple = false
};
}
private void BarcodesDetected(object sender, ZXing.Net.Maui.BarcodeDetectionEventArgs e) {
var first = e.Results?.FirstOrDefault();
if (first is null) {
return;
}
Dispatcher.DispatchAsync(async () => {
await DisplayAlert("Scan-Ergebnis", $"Barcode: {first.Value}", "OK");
});
}
}