CI / build-and-test (push) Canceled after 0s
- "Enter springt: Schüler für Schüler / Aufgabe für Aufgabe" im Dialog wählbar und gemerkt; Umschalt+Enter zurück, Pfeiltasten springen direkt und öffnen das Eingabefeld - Tasten per Tunnel-Handler abgefangen, bevor DataGrid/TextBox sie auswerten - Abwesende Schüler und Aufgaben der anderen Fassung werden übersprungen - Zellen lesen ihre Zeile aus dem DataContext (recycelte Zeilen schreiben nicht mehr falsch) - Bonusaufgaben zählen bei der angezeigten Nummerierung nicht mit Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
66 lines
2.5 KiB
C#
66 lines
2.5 KiB
C#
using Avalonia.Controls;
|
|
using LehrerApp.Core.Interfaces;
|
|
using LehrerApp.Core.Models;
|
|
using LehrerApp.Core.Services;
|
|
using LehrerApp.Desktop.ViewModels;
|
|
using LehrerApp.Desktop.ViewModels.Exams;
|
|
using LehrerApp.Desktop.ViewModels.Groups;
|
|
using LehrerApp.Desktop.Views.Groups;
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
|
|
namespace LehrerApp.Desktop.Views.Exams;
|
|
|
|
public partial class ExamsOverviewView : UserControl
|
|
{
|
|
private const int GroupDetailKlausurenTabIndex = 4;
|
|
|
|
public ExamsOverviewView() => InitializeComponent();
|
|
|
|
protected override void OnDataContextChanged(EventArgs e)
|
|
{
|
|
base.OnDataContextChanged(e);
|
|
if (DataContext is ExamsOverviewViewModel vm)
|
|
{
|
|
vm.OnGradeExam = ShowGradeExamDialog;
|
|
vm.OnEvaluateExam = ShowEvaluateExamDialog;
|
|
vm.OnNavigateToGroup = groupId => App.Services.GetRequiredService<MainWindowViewModel>()
|
|
.NavigateToGroupDetail(groupId, GroupDetailKlausurenTabIndex);
|
|
}
|
|
}
|
|
|
|
private async Task ShowGradeExamDialog(Exam exam)
|
|
{
|
|
var group = App.Services.GetRequiredService<IGroupRepository>().GetById(exam.GroupId);
|
|
if (group is null) return;
|
|
|
|
var dialogVm = new ExamGradingDialogViewModel(
|
|
App.Services.GetRequiredService<IExamResultRepository>(),
|
|
App.Services.GetRequiredService<IStudentRepository>(),
|
|
App.Services.GetRequiredService<IGroupMembershipRepository>(),
|
|
App.Services.GetRequiredService<GradingService>(),
|
|
exam, group.Id,
|
|
App.Services.GetRequiredService<ExamGradingSettingsService>());
|
|
|
|
var dialog = new ExamGradingDialog { DataContext = dialogVm };
|
|
var owner = TopLevel.GetTopLevel(this) as Window;
|
|
if (owner is not null) await dialog.ShowDialog(owner);
|
|
}
|
|
|
|
private async Task ShowEvaluateExamDialog(Exam exam)
|
|
{
|
|
var group = App.Services.GetRequiredService<IGroupRepository>().GetById(exam.GroupId);
|
|
if (group is null) return;
|
|
|
|
var dialogVm = new ExamEvaluationDialogViewModel(
|
|
App.Services.GetRequiredService<IExamRepository>(),
|
|
App.Services.GetRequiredService<IExamResultRepository>(),
|
|
App.Services.GetRequiredService<GradingService>(),
|
|
exam, group.GradingSystem,
|
|
App.Services.GetRequiredService<IStudentRepository>());
|
|
|
|
var dialog = new ExamEvaluationDialog { DataContext = dialogVm };
|
|
var owner = TopLevel.GetTopLevel(this) as Window;
|
|
if (owner is not null) await dialog.ShowDialog(owner);
|
|
}
|
|
}
|