34 lines
785 B
C#
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);
|
|
}
|