26 lines
832 B
C#
26 lines
832 B
C#
using Avalonia.Controls;
|
|
using Avalonia.Interactivity;
|
|
using LehrerApp.Desktop.ViewModels.Groups;
|
|
|
|
namespace LehrerApp.Desktop.Views.Groups;
|
|
|
|
public partial class StudentGroupGeneratorWindow : Window
|
|
{
|
|
private bool _isAnimating;
|
|
|
|
public StudentGroupGeneratorWindow() => InitializeComponent();
|
|
|
|
private async void OnGenerate(object? sender, RoutedEventArgs e)
|
|
{
|
|
if (_isAnimating || DataContext is not StudentGroupGeneratorViewModel vm ||
|
|
!vm.GenerateCommand.CanExecute(null)) return;
|
|
_isAnimating = true;
|
|
var results = this.FindControl<Grid>("GroupResults");
|
|
if (results is not null) results.Opacity = 0.15;
|
|
await Task.Delay(140);
|
|
vm.GenerateCommand.Execute(null);
|
|
if (results is not null) results.Opacity = 1;
|
|
_isAnimating = false;
|
|
}
|
|
}
|