Neuer Dialog "Deckblätter…" bei Klausuren, Punktetabelle als Drawing mit festen Spaltenbreiten, FLOWDRAWBOX-Attribut fit=content, Stapel-Rendering mit Seitenzahl je Datensatz, Kursbezeichnung und konfigurierbares Kürzel. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
34 lines
1.6 KiB
C#
34 lines
1.6 KiB
C#
using Avalonia.Controls;
|
|
using LehrerApp.Core.Interfaces;
|
|
using LehrerApp.Core.Models;
|
|
using LehrerApp.Core.Services;
|
|
using LehrerApp.Desktop.ViewModels.Groups;
|
|
using LehrerApp.Desktop.Views.Groups;
|
|
using LehrerApp.Templating;
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
|
|
namespace LehrerApp.Desktop.Services;
|
|
|
|
/// <summary>Öffnet den Deckblatt-Dialog zu einer Klausur — ein Einstieg für die Klausuren-
|
|
/// Hauptseite und den Klausuren-Tab der Lerngruppe.</summary>
|
|
public static class ExamCoverSheetDialogs
|
|
{
|
|
public static async Task ShowAsync(Control source, Exam exam)
|
|
{
|
|
var group = App.Services.GetRequiredService<IGroupRepository>().GetById(exam.GroupId);
|
|
if (group is null || TopLevel.GetTopLevel(source) is not Window owner) return;
|
|
var subject = group.SubjectId is { } subjectId
|
|
? App.Services.GetRequiredService<ISubjectRepository>().GetById(subjectId)?.Name ?? ""
|
|
: "";
|
|
var vm = new ExamCoverSheetDialogViewModel(exam, group, subject,
|
|
App.Services.GetRequiredService<IStudentRepository>(),
|
|
App.Services.GetRequiredService<IGroupMembershipRepository>(),
|
|
App.Services.GetRequiredService<IExamResultRepository>(),
|
|
App.Services.GetRequiredService<GradingService>(),
|
|
[App.Services.GetRequiredService<TemplateStore>(), App.Services.GetRequiredService<WorksheetTemplateStore>().Store],
|
|
App.Services.GetRequiredService<ITemplateBatchRenderer>(),
|
|
App.Services.GetRequiredService<TeacherSettingsService>().LoadAbbreviation());
|
|
await new ExamCoverSheetDialog { DataContext = vm }.ShowDialog(owner);
|
|
}
|
|
}
|