Gui Changes
This commit is contained in:
@@ -1,5 +1,6 @@
|
||||
using CommunityToolkit.Mvvm.ComponentModel;
|
||||
using CommunityToolkit.Mvvm.Input;
|
||||
using Jugenddienst_Stunden.Models;
|
||||
using Jugenddienst_Stunden.Types;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
@@ -26,6 +27,8 @@ namespace Jugenddienst_Stunden.ViewModels {
|
||||
}
|
||||
}
|
||||
|
||||
public string SubTitle { get; set; } = DateTime.Today.ToString("dddd, d. MMM. yyyy");
|
||||
|
||||
public int Identifier => (int)_stunde.id;
|
||||
|
||||
public ICommand SaveCommand { get; private set; }
|
||||
@@ -40,6 +43,7 @@ namespace Jugenddienst_Stunden.ViewModels {
|
||||
|
||||
public StundeViewModel(Types.DayTime stunde) {
|
||||
_stunde = stunde;
|
||||
|
||||
//SaveCommand = new AsyncRelayCommand(Save);
|
||||
//DeleteCommand = new AsyncRelayCommand(Delete);
|
||||
}
|
||||
@@ -59,8 +63,9 @@ namespace Jugenddienst_Stunden.ViewModels {
|
||||
if (query.ContainsKey("load")) {
|
||||
//DateTime heute = DateTime.Now;
|
||||
_stunde = await Models.Stunde.LoadEntry(Convert.ToInt32(query["load"]));
|
||||
|
||||
SubTitle = _stunde.day.ToString("dddd, d. MMM. yyyy");
|
||||
OnPropertyChanged(nameof(Stunde));
|
||||
OnPropertyChanged(nameof(SubTitle));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -20,6 +20,7 @@ namespace Jugenddienst_Stunden.ViewModels {
|
||||
public string ShowDay => "Zeit an Tag " + GetDay.ToString("ddd d. MMM") + ": ";
|
||||
|
||||
public int id { get; set; }
|
||||
public ICommand NewEntryCommand { get; }
|
||||
public ICommand SelectEntryCommand { get; }
|
||||
|
||||
public ICommand LoadDataCommand { get; private set; }
|
||||
@@ -133,12 +134,18 @@ namespace Jugenddienst_Stunden.ViewModels {
|
||||
_hour = new Types.Hours();
|
||||
LoadDataCommand = new AsyncRelayCommand(LoadData);
|
||||
|
||||
NewEntryCommand = new AsyncRelayCommand(NewEntryAsync);
|
||||
SelectEntryCommand = new AsyncRelayCommand<DayTime>(SelectEntryAsync);
|
||||
|
||||
_ = LoadDay(DateTime.Today);
|
||||
OnPropertyChanged(nameof(DayTimes));
|
||||
}
|
||||
|
||||
private async Task NewEntryAsync() {
|
||||
await Shell.Current.GoToAsync(nameof(Views.StundePage));
|
||||
}
|
||||
|
||||
private async Task SelectEntryAsync(DayTime entry) {
|
||||
|
||||
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");
|
||||
|
||||
@@ -5,6 +5,7 @@
|
||||
x:Class="Jugenddienst_Stunden.Views.AllNotesPage"
|
||||
Title="Deine Notizen"
|
||||
NavigatedTo="ContentPage_NavigatedTo">
|
||||
|
||||
<ContentPage.BindingContext>
|
||||
<viewModels:NotesViewModel />
|
||||
</ContentPage.BindingContext>
|
||||
@@ -14,7 +15,9 @@
|
||||
<ToolbarItem Text="Add" Command="{Binding NewCommand}" IconImageSource="{FontImage Glyph='+', Color=Black, Size=22}" />
|
||||
</ContentPage.ToolbarItems>
|
||||
|
||||
<VerticalStackLayout>
|
||||
<Label Text="Werden nur lokal gespeichert"/>
|
||||
|
||||
<!-- Display notes in a list -->
|
||||
<CollectionView x:Name="notesCollection"
|
||||
ItemsSource="{Binding AllNotes}"
|
||||
@@ -38,4 +41,6 @@
|
||||
</DataTemplate>
|
||||
</CollectionView.ItemTemplate>
|
||||
</CollectionView>
|
||||
|
||||
</VerticalStackLayout>
|
||||
</ContentPage>
|
||||
@@ -3,16 +3,16 @@
|
||||
xmlns:x="http://schemas.microsoft.com/winfx/2009/xaml"
|
||||
xmlns:models="clr-namespace:Jugenddienst_Stunden.ViewModels"
|
||||
x:Class="Jugenddienst_Stunden.Views.StundePage"
|
||||
Title="StundePage">
|
||||
Title="Eintrag bearbeiten">
|
||||
|
||||
<ContentPage.BindingContext>
|
||||
<models:StundeViewModel />
|
||||
</ContentPage.BindingContext>
|
||||
|
||||
<VerticalStackLayout Spacing="10" Margin="10">
|
||||
<Label Text="{Binding SubTitle}" />
|
||||
|
||||
|
||||
<Grid Padding="15,10,0,10">
|
||||
<Grid Padding="5,10,5,10">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
@@ -29,11 +29,11 @@
|
||||
|
||||
<!--<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" />
|
||||
<Editor Grid.Row="1" Grid.Column="0" Grid.ColumnSpan="2" Placeholder="Beschreibung" Text="{Binding Stunde.description}" MinimumHeightRequest="40" AutoSize="TextChanges" />
|
||||
</Grid>
|
||||
|
||||
<Grid ColumnDefinitions="*,*" ColumnSpacing="4">
|
||||
<Button Text="Save" Clicked="GetDayTime" />
|
||||
<Button Text="Save" />
|
||||
|
||||
<Button Grid.Column="1"
|
||||
Text="Delete" />
|
||||
|
||||
@@ -6,23 +6,8 @@ namespace Jugenddienst_Stunden.Views;
|
||||
public partial class StundePage : ContentPage
|
||||
{
|
||||
|
||||
private DayTime _stunde;
|
||||
|
||||
public StundePage()
|
||||
{
|
||||
//GetDayTime();
|
||||
InitializeComponent();
|
||||
|
||||
}
|
||||
|
||||
private async void GetDayTime() {
|
||||
_stunde = await Models.Stunde.LoadEntry(4096);
|
||||
//_stunde = new DayTime();
|
||||
//_stunde.description = "asd";
|
||||
//StundeDescription.Text = _stunde.description;
|
||||
}
|
||||
|
||||
private void GetDayTime(object sender, EventArgs e) {
|
||||
GetDayTime();
|
||||
}
|
||||
}
|
||||
@@ -10,14 +10,12 @@
|
||||
</ContentPage.BindingContext>
|
||||
|
||||
<ContentPage.ToolbarItems>
|
||||
<ToolbarItem Text="Add" Command="{Binding NewCommand}" IconImageSource="{FontImage Glyph='+', Color=Black, Size=22}" />
|
||||
<ToolbarItem Text="Add" Command="{Binding NewEntryCommand}" IconImageSource="{FontImage Glyph='+', Color=Black, Size=22}" />
|
||||
</ContentPage.ToolbarItems>
|
||||
|
||||
<ScrollView Margin="5">
|
||||
|
||||
<VerticalStackLayout Spacing="10" Margin="10">
|
||||
|
||||
|
||||
|
||||
<Grid RowDefinitions="Auto" ColumnDefinitions="Auto,*">
|
||||
<DatePicker Grid.Column="0" MinimumDate="{Binding MinimumDate}"
|
||||
MaximumDate="{Binding MaximumDate}"
|
||||
@@ -27,10 +25,10 @@
|
||||
</Border>
|
||||
</Grid>
|
||||
|
||||
|
||||
<CollectionView
|
||||
ItemsSource="{Binding DayTimes}"
|
||||
x:Name="stundeItems" Margin="0"
|
||||
HeightRequest="350"
|
||||
SelectionMode="Single"
|
||||
SelectionChangedCommand="{Binding SelectEntryCommand}"
|
||||
SelectionChangedCommandParameter="{Binding Source={RelativeSource Self}, Path=SelectedItem}">
|
||||
@@ -41,7 +39,7 @@
|
||||
|
||||
<CollectionView.ItemTemplate>
|
||||
<DataTemplate>
|
||||
<Grid Padding="15,10,0,0">
|
||||
<Grid Padding="5,10,5,0">
|
||||
<Grid.RowDefinitions>
|
||||
<RowDefinition Height="Auto" />
|
||||
<RowDefinition Height="Auto" />
|
||||
@@ -115,5 +113,5 @@
|
||||
|
||||
|
||||
</VerticalStackLayout>
|
||||
</ScrollView>
|
||||
|
||||
</ContentPage>
|
||||
Reference in New Issue
Block a user