Confirm Delete

This commit is contained in:
2024-10-12 17:19:18 +02:00
parent 23328466bd
commit a7a940a70b
3 changed files with 46 additions and 18 deletions

View File

@@ -43,7 +43,7 @@
<Grid ColumnDefinitions="*,*" ColumnSpacing="4">
<Button Text="Speichern" Command="{Binding SaveCommand}" />
<Button Grid.Column="1" Text="Löschen" Command="{Binding DeleteCommand}" />
<Button Grid.Column="1" Text="Löschen" Command="{Binding DeleteConfirmCommand}" />
</Grid>
</VerticalStackLayout>
</ContentPage>

View File

@@ -1,13 +1,30 @@
using Jugenddienst_Stunden.Types;
using System.ComponentModel;
using Jugenddienst_Stunden.ViewModels;
using System.Windows.Input;
namespace Jugenddienst_Stunden.Views;
public partial class StundePage : ContentPage
{
public partial class StundePage : ContentPage {
public StundePage()
{
public ICommand DeleteConfirmCommand { get; }
public StundePage() {
InitializeComponent();
if (BindingContext is StundeViewModel vm) {
//vm.AlertEvent += Vm_AlertEvent;
//vm.InfoEvent += Vm_InfoEvent;
vm.ConfirmEvent += ShowConfirm;
}
}
private void Vm_AlertEvent(object? sender, string e) {
DisplayAlert("Fehler:", e, "OK");
}
private async Task<bool> ShowConfirm(string title, string message) {
return await DisplayAlert(title, message, "Passt!", "Na, nor decht nit.");
}
}