using Avalonia.Controls; using Avalonia.Interactivity; using LehrerApp.Desktop.ViewModels.Groups; namespace LehrerApp.Desktop.Views.Groups; public partial class RandomStudentPickerWindow : Window { private bool _isAnimating; public RandomStudentPickerWindow() => InitializeComponent(); private async void OnDraw(object? sender, RoutedEventArgs e) { if (_isAnimating || DataContext is not RandomStudentPickerViewModel vm || !vm.DrawCommand.CanExecute(null)) return; _isAnimating = true; var card = this.FindControl("RevealCard"); if (card is not null) card.Opacity = 0.15; await Task.Delay(150); vm.DrawCommand.Execute(null); if (card is not null) card.Opacity = 1; _isAnimating = false; } }