Variable Höhe der Stundenliste

This commit is contained in:
2024-10-14 11:30:51 +02:00
parent e4d3fb2d82
commit 17be817e23
6 changed files with 23 additions and 7 deletions

View File

@@ -12,5 +12,9 @@ public partial class AppShell : Shell {
//Seiten, die nicht in der Appshell sichtbar sind, aber trotzdem aufgerufen werden können //Seiten, die nicht in der Appshell sichtbar sind, aber trotzdem aufgerufen werden können
Routing.RegisterRoute(nameof(Views.NotePage), typeof(Views.NotePage)); Routing.RegisterRoute(nameof(Views.NotePage), typeof(Views.NotePage));
Routing.RegisterRoute(nameof(Views.StundePage), typeof(Views.StundePage)); Routing.RegisterRoute(nameof(Views.StundePage), typeof(Views.StundePage));
} }
} }

View File

@@ -1,4 +1,5 @@
using ZXing.Net.Maui.Controls; using Microsoft.Extensions.Logging;
using ZXing.Net.Maui.Controls;
namespace Jugenddienst_Stunden; namespace Jugenddienst_Stunden;

View File

@@ -12,7 +12,7 @@
<!-- Add an item to the toolbar --> <!-- Add an item to the toolbar -->
<ContentPage.ToolbarItems> <ContentPage.ToolbarItems>
<ToolbarItem Text="Add" Command="{Binding NewCommand}" IconImageSource="{FontImage Glyph='+', Color=Black, Size=22}" /> <ToolbarItem Text="Neue Notiz" Command="{Binding NewCommand}" IconImageSource="{FontImage Glyph='+', Color=Black, Size=22}" />
</ContentPage.ToolbarItems> </ContentPage.ToolbarItems>
<VerticalStackLayout Margin="20,0,0,0"> <VerticalStackLayout Margin="20,0,0,0">

View File

@@ -60,7 +60,8 @@ public partial class LoginPage : ContentPage {
Preferences.Default.Set("EmployeeId", int.Parse(op.id)); Preferences.Default.Set("EmployeeId", int.Parse(op.id));
await DisplayAlert("Login erfolgreich", op.name + " " + op.surname, "OK"); await DisplayAlert("Login erfolgreich", op.name + " " + op.surname, "OK");
await Navigation.PopAsync(); if (Navigation.NavigationStack.Count > 1)
await Navigation.PopAsync();
} catch (Exception e) { } catch (Exception e) {
await DisplayAlert("Fehler", e.Message, "OK"); await DisplayAlert("Fehler", e.Message, "OK");
} }

View File

@@ -18,14 +18,14 @@
<ContentPage.ToolbarItems> <ContentPage.ToolbarItems>
<!--<ToolbarItem Text="Lade Liste" Command="{Binding RefreshListCommand}"/>--> <!--<ToolbarItem Text="Lade Liste" Command="{Binding RefreshListCommand}"/>-->
<ToolbarItem Text="Add" IconImageSource="{StaticResource ToolbarIcon}" Command="{Binding NewEntryCommand}" /> <ToolbarItem Text="Neuer Eintrag" IconImageSource="{StaticResource ToolbarIcon}" Command="{Binding NewEntryCommand}" />
</ContentPage.ToolbarItems> </ContentPage.ToolbarItems>
<VerticalStackLayout Spacing="10" Margin="10"> <VerticalStackLayout Spacing="10" Margin="10">
<Grid RowDefinitions="Auto" ColumnDefinitions="Auto,*"> <Grid RowDefinitions="Auto" ColumnDefinitions="Auto,*" HeightRequest="50">
<DatePicker Grid.Column="0" MinimumDate="{Binding MinimumDate}" <DatePicker Grid.Column="0" MinimumDate="{Binding MinimumDate}"
MaximumDate="{Binding MaximumDate}" MaximumDate="{Binding MaximumDate}"
Date="{Binding DateToday}" Format="dddd, d. MMMM yyyy" /> Date="{Binding DateToday}" Format="dddd, d. MMMM yyyy" />
@@ -37,7 +37,7 @@
<CollectionView <CollectionView
ItemsSource="{Binding DayTimes}" ItemsSource="{Binding DayTimes}"
x:Name="stundeItems" Margin="0" x:Name="stundeItems" Margin="0"
HeightRequest="350" HeightRequest="300"
SelectionMode="Single" SelectionMode="Single"
SelectionChangedCommand="{Binding SelectEntryCommand}" SelectionChangedCommand="{Binding SelectEntryCommand}"
SelectionChangedCommandParameter="{Binding Source={RelativeSource Self}, Path=SelectedItem}"> SelectionChangedCommandParameter="{Binding Source={RelativeSource Self}, Path=SelectedItem}">
@@ -92,7 +92,7 @@
<BoxView HeightRequest="1" /> <BoxView HeightRequest="1" />
<Button Text="{Binding LoadOverview}" Command="{Binding LoadDataCommand}" /> <Button Text="{Binding LoadOverview}" Command="{Binding LoadDataCommand}" />
<Frame Padding="2"> <Frame Padding="2" HeightRequest="125">
<Grid RowDefinitions="Auto,Auto,Auto,Auto,Auto,*" ColumnDefinitions="Auto,*" Margin="10,2"> <Grid RowDefinitions="Auto,Auto,Auto,Auto,Auto,*" ColumnDefinitions="Auto,*" Margin="10,2">
<Label Grid.Row="0" Text="Soll:" /> <Label Grid.Row="0" Text="Soll:" />
<Label Grid.Row="1" Text="Summe:" /> <Label Grid.Row="1" Text="Summe:" />

View File

@@ -25,6 +25,8 @@ public partial class StundenPage : ContentPage {
//// Berechnen der gew<65>nschten H<>he //// Berechnen der gew<65>nschten H<>he
//var desiredHeight = screenHeight - 450; // Abz<62>glich der Stunden<65>bersicht //var desiredHeight = screenHeight - 450; // Abz<62>glich der Stunden<65>bersicht
//stundeItems.HeightRequest = desiredHeight; //stundeItems.HeightRequest = desiredHeight;
SizeChanged += OnPageSizeChanged;
} }
private void Vm_AlertEvent(object? sender, string e) { private void Vm_AlertEvent(object? sender, string e) {
@@ -50,5 +52,13 @@ public partial class StundenPage : ContentPage {
await Navigation.PushAsync(new LoginPage()); await Navigation.PushAsync(new LoginPage());
} }
private void OnPageSizeChanged(object sender, EventArgs e) {
double windowHeight = this.Height;
AdjustLayout(windowHeight);
}
private void AdjustLayout(double height) {
// Passen Sie Ihre UI-Elemente basierend auf der Fensterh<72>he an
stundeItems.HeightRequest = height - 300; //Datepicker Height 50, Monatssummen Height 125, Titel + Navigation Height xyz
}
} }