BarcodeScanner
This commit is contained in:
@@ -2,8 +2,9 @@
|
||||
<ContentPage xmlns="http://schemas.microsoft.com/dotnet/2021/maui"
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||
xmlns:models="clr-namespace:Jugenddienst_Stunden.ViewModels"
|
||||
xmlns:scanner="clr-namespace:BarcodeScanning;assembly=BarcodeScanning.Native.Maui"
|
||||
xmlns:zxing="clr-namespace:ZXing.Net.Maui.Controls;assembly=ZXing.Net.MAUI.Controls"
|
||||
x:Class="Jugenddienst_Stunden.Views.AboutPage">
|
||||
|
||||
<ContentPage.BindingContext>
|
||||
<models:AboutViewModel />
|
||||
</ContentPage.BindingContext>
|
||||
@@ -24,6 +25,11 @@
|
||||
OnDetectionFinished="BarcodesDetected"
|
||||
HorizontalOptions="FillAndExpand"
|
||||
VerticalOptions="FillAndExpand" />-->
|
||||
|
||||
<zxing:CameraBarcodeReaderView x:Name="barcodeScannerView"
|
||||
BarcodesDetected="BarcodesDetected"
|
||||
HorizontalOptions="FillAndExpand"
|
||||
VerticalOptions="FillAndExpand" />
|
||||
</VerticalStackLayout>
|
||||
|
||||
|
||||
|
||||
@@ -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");
|
||||
});
|
||||
}
|
||||
|
||||
}
|
||||
@@ -12,14 +12,19 @@
|
||||
|
||||
<Button Text="Load data" Command="{Binding LoadDataCommand}" />
|
||||
|
||||
<Grid RowDefinitions="Auto,Auto,Auto" ColumnDefinitions="Auto,*" Margin="10">
|
||||
<Label Text="Nominal:" Grid.Row="0" />
|
||||
<Label Text="Overtime:" Grid.Row="1" />
|
||||
<Label Text="OvertimeMonth:" Grid.Row="2" Margin="0,0,5,0" />
|
||||
<Grid RowDefinitions="Auto,Auto,Auto,Auto,Auto" ColumnDefinitions="Auto,*" Margin="10">
|
||||
<Label Text="Soll:" Grid.Row="0" />
|
||||
<Label Text="Gearbeitet:" Grid.Row="1" />
|
||||
<Label Text="Berechnet:" Grid.Row="2" />
|
||||
<Label Text="Überstunden Monat:" Grid.Row="3" Margin="0,0,15,0" />
|
||||
<Label Text="Überstunden Jahr:" Grid.Row="4" />
|
||||
|
||||
|
||||
<Label BackgroundColor="AliceBlue" Grid.Row="0" Grid.Column="1" Text="{Binding Nominal}" />
|
||||
<Label BackgroundColor="AliceBlue" Grid.Row="1" Grid.Column="1" Text="{Binding Overtime}" />
|
||||
<Label BackgroundColor="LightSlateGray" Grid.Row="2" Grid.Column="1" Text="{Binding OvertimeMonth}" />
|
||||
<Label BackgroundColor="AliceBlue" Grid.Row="1" Grid.Column="1" Text="{Binding ZeitDone}" />
|
||||
<Label BackgroundColor="AliceBlue" Grid.Row="2" Grid.Column="1" Text="{Binding ZeitCalculated}" />
|
||||
<Label BackgroundColor="AliceBlue" Grid.Row="3" Grid.Column="1" Text="{Binding OvertimeMonth}" />
|
||||
<Label BackgroundColor="AliceBlue" Grid.Row="4" Grid.Column="1" Text="{Binding Overtime}" />
|
||||
</Grid>
|
||||
</VerticalStackLayout>
|
||||
</ContentPage>
|
||||
Reference in New Issue
Block a user