Files
LehrerApp/LehrerApp.Desktop/Views/Groups/RandomStudentPickerWindow.axaml.cs
T
admin c79d96c5ec
CI / build-and-test (push) Canceled after 0s
Add intelligent random student picker
2026-09-29 14:02:48 +02:00

27 lines
800 B
C#

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<Border>("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;
}
}