Kapitel 7 abgeschlossen.

This commit is contained in:
2026-08-16 00:29:01 +02:00
parent da8d2bb1da
commit f9e398b225
47 changed files with 2636 additions and 107 deletions
@@ -23,6 +23,8 @@ public partial class StudentDetailView : UserControl
vm.OnConfirmDeleteDocumentation = ShowDeleteDocumentationDialog;
vm.OnSaveExportFile = SaveExportFile;
vm.OnConductParentCall = ShowParentCallSessionDialog;
vm.OnManageStudent = ShowManageStudentDialog;
vm.OnCreateLetter = ShowCreateLetterDialog;
}
private async Task<Contact?> ShowContactDialog(Contact? contact)
@@ -36,6 +38,32 @@ public partial class StudentDetailView : UserControl
return saved ? vm.Result : null;
}
private async Task<StudentManagementResult> ShowManageStudentDialog(Student student)
{
var owner = TopLevel.GetTopLevel(this) as Window;
if (owner is null) return StudentManagementResult.Cancelled;
var vm = new ManageStudentDialogViewModel(
App.Services.GetRequiredService<IStudentRepository>(), student);
var dialog = new ManageStudentDialog { DataContext = vm };
return await dialog.ShowDialog<StudentManagementResult>(owner);
}
private async Task ShowCreateLetterDialog()
{
var owner = TopLevel.GetTopLevel(this) as Window;
if (owner is null || DataContext is not StudentDetailViewModel { Student: { } student }) return;
var vm = new CreateLetterDialogViewModel(student,
App.Services.GetRequiredService<LehrerApp.Core.Services.LetterTemplateService>(),
App.Services.GetRequiredService<IGroupMembershipRepository>(),
App.Services.GetRequiredService<IGroupRepository>());
var dialog = new CreateLetterDialog { DataContext = vm };
var path = await dialog.ShowDialog<string?>(owner);
if (!string.IsNullOrEmpty(path) && File.Exists(path))
System.Diagnostics.Process.Start(new System.Diagnostics.ProcessStartInfo(path) { UseShellExecute = true });
}
private void ShowAddressViewer(ContactItem contact)
{
if (!contact.HasAddress) return;