Files
LehrerApp/LehrerApp.Desktop/Views/Groups/AddGroupDialog.axaml.cs
2026-03-29 23:47:31 +02:00

34 lines
785 B
C#

using Avalonia.Controls;
using Avalonia.Interactivity;
namespace LehrerApp.Desktop.Views.Groups;
public partial class AddGroupDialog : Window
{
public bool Saved { get; private set; }
public AddGroupDialog()
{
InitializeComponent();
}
private void OnSave(object? sender, RoutedEventArgs e)
{
if (DataContext is ViewModels.Groups.AddGroupDialogViewModel vm)
{
if (vm.SaveCommand.CanExecute(null))
{
vm.SaveCommand.Execute(null);
if (vm.Result is not null)
{
Saved = true;
Close(true);
}
}
}
}
private void OnCancel(object? sender, RoutedEventArgs e) =>
Close(false);
}