This commit is contained in:
1 parent
770a1833c8
commit
c79d96c5ec
7 files changed
+426
No files matched your search
@@ -22,6 +22,7 @@ public partial class MainWindow : Window
|
||||
private SyncEngine? _syncEngine;
|
||||
private bool _finalSyncStarted;
|
||||
private bool _closeAfterFinalSync;
|
||||
private RandomStudentPickerWindow? _randomStudentPickerWindow;
|
||||
|
||||
public MainWindow()
|
||||
{
|
||||
@@ -71,6 +72,27 @@ public partial class MainWindow : Window
|
||||
await new PersonalizeWorksheetDialog { DataContext = dialogVm }.ShowDialog(this);
|
||||
}
|
||||
|
||||
private void OnOpenRandomStudentPicker(object? sender, Avalonia.Interactivity.RoutedEventArgs e)
|
||||
{
|
||||
if (_randomStudentPickerWindow is not null)
|
||||
{
|
||||
_randomStudentPickerWindow.Activate();
|
||||
return;
|
||||
}
|
||||
|
||||
var currentGroupId = (DataContext as MainWindowViewModel)?.CurrentGroupDetail?.Group?.Id;
|
||||
var vm = new RandomStudentPickerViewModel(
|
||||
App.Services.GetRequiredService<IStudentRepository>(),
|
||||
App.Services.GetRequiredService<IGroupRepository>(),
|
||||
App.Services.GetRequiredService<IGroupMembershipRepository>(),
|
||||
App.Services.GetRequiredService<IParticipationSessionRepository>(),
|
||||
App.Services.GetRequiredService<IParticipationRepository>(),
|
||||
currentGroupId);
|
||||
_randomStudentPickerWindow = new RandomStudentPickerWindow { DataContext = vm };
|
||||
_randomStudentPickerWindow.Closed += (_, _) => _randomStudentPickerWindow = null;
|
||||
_randomStudentPickerWindow.Show();
|
||||
}
|
||||
|
||||
private void OnWindowKeyDown(object? sender, KeyEventArgs e)
|
||||
{
|
||||
if (DataContext is not MainWindowViewModel vm) return;
|
||||
|
||||
Reference in new issue
Block a user