28 lines
651 B
C#
28 lines
651 B
C#
using ZXing;
|
|
using ZXing.Net.Maui.Controls;
|
|
namespace Jugenddienst_Stunden.Views;
|
|
|
|
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");
|
|
});
|
|
}
|
|
|
|
} |