BarcodeScanner
This commit is contained in:
@@ -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");
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user