CI / build-and-test (push) Canceled after 0s
Neuer Dialog ExamRevealDialog: zeigt zunächst nur den Namen eines Schülers, erst nach „Aufdecken“ Note, Punktzahl und Punkte je Aufgabe. Blättern und gezielte Auswahl oben; jeder Schülerwechsel deckt wieder zu. Erreichbar über „Einzelansicht“ im Klausuren-Tab und auf der Klausuren-Hauptseite. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
80 lines
3.1 KiB
C#
80 lines
3.1 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.OnRevealExam = ShowRevealExamDialog;
|
|
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);
|
|
}
|
|
|
|
private async Task ShowRevealExamDialog(Exam exam)
|
|
{
|
|
var dialogVm = new ExamRevealDialogViewModel(
|
|
App.Services.GetRequiredService<IExamResultRepository>(),
|
|
App.Services.GetRequiredService<IStudentRepository>(),
|
|
App.Services.GetRequiredService<GradingService>(),
|
|
exam);
|
|
|
|
var dialog = new ExamRevealDialog { DataContext = dialogVm };
|
|
var owner = TopLevel.GetTopLevel(this) as Window;
|
|
if (owner is not null) await dialog.ShowDialog(owner);
|
|
}
|
|
}
|