27 lines
800 B
C#
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;
|
|
}
|
|
}
|