Detailseite Anpassungen

This commit is contained in:
2024-09-18 20:26:09 +02:00
parent cf89527585
commit d9cca07550
8 changed files with 64 additions and 46 deletions

View File

@@ -13,12 +13,7 @@
Icon="{OnPlatform 'icon_watch.png', iOS='icon_watch_ios.png', MacCatalyst='icon_watch_ios.png'}" />
<ShellContent
Title="Stunde"
ContentTemplate="{DataTemplate views:StundePage}"
Icon="{OnPlatform 'icon_watch.png', iOS='icon_watch_ios.png', MacCatalyst='icon_watch_ios.png'}" />
<ShellContent
Title="Notes"
Title="Notizen"
ContentTemplate="{DataTemplate views:AllNotesPage}"
Icon="{OnPlatform 'icon_notes.png', iOS='icon_notes_ios.png', MacCatalyst='icon_notes_ios.png'}" />

View File

@@ -1,5 +1,6 @@
using CommunityToolkit.Mvvm.ComponentModel;
using CommunityToolkit.Mvvm.Input;
using Jugenddienst_Stunden.Types;
using System;
using System.Collections.Generic;
using System.Linq;
@@ -13,6 +14,8 @@ namespace Jugenddienst_Stunden.ViewModels {
public int id { get; set; }
private Types.DayTime _stunde;
public DayTime Stunde { get => _stunde; }
public string Description {
get => _stunde.description;
set {
@@ -56,9 +59,8 @@ namespace Jugenddienst_Stunden.ViewModels {
if (query.ContainsKey("load")) {
//DateTime heute = DateTime.Now;
_stunde = await Models.Stunde.LoadEntry(Convert.ToInt32(query["load"]));
//_stunde = await Models.Stunde.LoadData();
//_note = Models.Note.Load(query["load"].ToString());
//RefreshProperties();
OnPropertyChanged(nameof(Stunde));
}
}
}

View File

@@ -74,7 +74,7 @@ namespace Jugenddienst_Stunden.ViewModels {
GetDay = value;
OnPropertyChanged();
_ = LoadDay(value); // Use discard operator to explicitly ignore the returned Task
//RefreshProperties();
//RefreshProperties();
OnPropertyChanged(nameof(TimeDay));
OnPropertyChanged(nameof(ShowDay));
OnPropertyChanged(nameof(DayTimes));
@@ -114,22 +114,22 @@ namespace Jugenddienst_Stunden.ViewModels {
public StundenViewModel() {
// Options = new ObservableCollection<string> {
// "Gemeinde 1",
// "Gemeinde 2",
// "Gemeinde 3",
// "Gemeinde 4"
//};
// OptionsProjekt = new ObservableCollection<string> {
// "Projekt 1",
// "Projekt 2",
// "Projekt 3"
//};
// OptionsFreistellung = new ObservableCollection<string> {
// "Urlaub",
// "Krankheit",
// "Elternzeit"
//};
// Options = new ObservableCollection<string> {
// "Gemeinde 1",
// "Gemeinde 2",
// "Gemeinde 3",
// "Gemeinde 4"
//};
// OptionsProjekt = new ObservableCollection<string> {
// "Projekt 1",
// "Projekt 2",
// "Projekt 3"
//};
// OptionsFreistellung = new ObservableCollection<string> {
// "Urlaub",
// "Krankheit",
// "Elternzeit"
//};
_hour = new Types.Hours();
LoadDataCommand = new AsyncRelayCommand(LoadData);
@@ -138,8 +138,10 @@ namespace Jugenddienst_Stunden.ViewModels {
}
private async Task SelectEntryAsync(DayTime entry) {
if (entry != null)
if (entry != null && entry.id != null)
await Shell.Current.GoToAsync($"{nameof(Views.StundePage)}?load={entry.id}");
else AlertEvent?.Invoke(this, "Auswahl enthält keine Daten");
}
@@ -160,11 +162,11 @@ namespace Jugenddienst_Stunden.ViewModels {
try {
_hour.daytime = await Models.Stunde.LoadDay(date);
////if (_hour.zeit_total_daily_api != null) {
////TimeDay = _hour.zeit_total_daily_api.Where(static p => p.Day == GetDay.Day).ToList() ?? new List<TimeDay> { new TimeDay { Day = GetDay.Day, Hours = 0 } };
//RefreshProperties();
OnPropertyChanged(nameof(ShowDay));
OnPropertyChanged(nameof(TimeDay));
OnPropertyChanged(nameof(DayTimes));
////TimeDay = _hour.zeit_total_daily_api.Where(static p => p.Day == GetDay.Day).ToList() ?? new List<TimeDay> { new TimeDay { Day = GetDay.Day, Hours = 0 } };
//RefreshProperties();
OnPropertyChanged(nameof(ShowDay));
OnPropertyChanged(nameof(TimeDay));
OnPropertyChanged(nameof(DayTimes));
////}
} catch (Exception e) {
AlertEvent?.Invoke(this, e.Message);

View File

@@ -3,7 +3,7 @@
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
xmlns:viewModels="clr-namespace:Jugenddienst_Stunden.ViewModels"
x:Class="Jugenddienst_Stunden.Views.AllNotesPage"
Title="Your Notes"
Title="Deine Notizen"
NavigatedTo="ContentPage_NavigatedTo">
<ContentPage.BindingContext>
<viewModels:NotesViewModel />
@@ -14,6 +14,7 @@
<ToolbarItem Text="Add" Command="{Binding NewCommand}" IconImageSource="{FontImage Glyph='+', Color=Black, Size=22}" />
</ContentPage.ToolbarItems>
<Label Text="Werden nur lokal gespeichert"/>
<!-- Display notes in a list -->
<CollectionView x:Name="notesCollection"
ItemsSource="{Binding AllNotes}"

View File

@@ -11,7 +11,7 @@
<Editor x:Name="TextEditor"
Placeholder="Enter your note"
Text="{Binding Text}"
HeightRequest="100" />
HeightRequest="80" />
<Grid ColumnDefinitions="*,*" ColumnSpacing="4">
<Button Text="Save"

View File

@@ -9,15 +9,29 @@
<models:StundeViewModel />
</ContentPage.BindingContext>
<VerticalStackLayout>
<Label
x:Name="StundeDescription"
Text="Welcome to .NET MAUI!"
VerticalOptions="Center"
HorizontalOptions="Center" />
<Label x:Name="DescBinding" Text="{Binding Stunde.description}"/>
<Label x:Name="BeginBinding" Text="{Binding Stunde.begin}"/>
<Label x:Name="EndBinding" Text="{Binding Stunde.end}"/>
<VerticalStackLayout Spacing="10" Margin="10">
<Grid Padding="15,10,0,10">
<Grid.RowDefinitions>
<RowDefinition Height="Auto" />
<RowDefinition Height="Auto" />
</Grid.RowDefinitions>
<Grid.ColumnDefinitions>
<ColumnDefinition Width="*" />
<ColumnDefinition Width="*" />
</Grid.ColumnDefinitions>
<HorizontalStackLayout Grid.Row="0" Grid.Column="0">
<Label Grid.Row="0" Grid.Column="0" Text="{Binding Stunde.begin}"/>
<Label Text="bis" Padding="10,0,10,0"/>
<Label Grid.Row="0" Grid.Column="1" Text="{Binding Stunde.end}"/>
</HorizontalStackLayout>
<!--<Label Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2" Text="{Binding Stunde.description}" Padding="0,0,0,5"/>-->
<Editor Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2" Placeholder="Beschreibung" Text="{Binding Stunde.description}" HeightRequest="40" />
</Grid>
<Grid ColumnDefinitions="*,*" ColumnSpacing="4">
<Button Text="Save" Clicked="GetDayTime" />

View File

@@ -19,7 +19,7 @@ public partial class StundePage : ContentPage
_stunde = await Models.Stunde.LoadEntry(4096);
//_stunde = new DayTime();
//_stunde.description = "asd";
StundeDescription.Text = _stunde.description;
//StundeDescription.Text = _stunde.description;
}
private void GetDayTime(object sender, EventArgs e) {

View File

@@ -9,6 +9,10 @@
<models:StundenViewModel />
</ContentPage.BindingContext>
<ContentPage.ToolbarItems>
<ToolbarItem Text="Add" Command="{Binding NewCommand}" IconImageSource="{FontImage Glyph='+', Color=Black, Size=22}" />
</ContentPage.ToolbarItems>
<ScrollView Margin="5">
<VerticalStackLayout Spacing="10" Margin="10">