Dokumentationseinträge mit Typwahl (Gespräch, Vorkommnis, Förderplan, Fehlzeit, Elternanruf, Elternbrief), vertrauliche Einträge nur nach Bestätigung sichtbar, weiche Löschung mit Nachvollziehbarkeit. Fehlzeiten als Auswertung des bestehenden Anwesenheits-Trackings statt zweiter Erfassung, mit Schwellenwert-Warnung im Schülerdetail und Dashboard. Förderplan-Wiedervorlage als Dashboard-Karte. Datenschutz: Löschfristen mit manueller Bereinigung und DSGVO-Art.-15-Datenauskunft als Export. Auf Nutzer-Feedback hin ergänzt: Elternanruf mit begleitendem Gesprächsprotokoll-Dialog (Punkte abhaken, Eindrücke festhalten), Elternbrief mit Versand-/Rückmeldungs-Tracking, Datei-Anhänge über LiteDBs Dateispeicher, frei vergebbare Labels zur Nachverfolgung mit Dringlichkeits-Farbcodierung, sowie eine sichtbare Farblegende für das bestehende Notenentwicklungs-Diagramm. Dabei einen Absturz behoben: leere Textfelder lieferten über das Binding null statt "", was beim Speichern eine NullReferenceException auslöste. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
88 lines
3.5 KiB
C#
88 lines
3.5 KiB
C#
using Avalonia;
|
|
using Avalonia.Controls.ApplicationLifetimes;
|
|
using Avalonia.Markup.Xaml;
|
|
using LehrerApp.Core.Services;
|
|
using LehrerApp.Data;
|
|
using LehrerApp.Desktop.Services;
|
|
using LehrerApp.Desktop.ViewModels;
|
|
using LehrerApp.Desktop.ViewModels.Groups;
|
|
using LehrerApp.Desktop.ViewModels.Students;
|
|
using LehrerApp.Desktop.Views;
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
|
|
namespace LehrerApp.Desktop;
|
|
|
|
public class App : Application
|
|
{
|
|
public static IServiceProvider Services { get; private set; } = null!;
|
|
|
|
public override void Initialize() => AvaloniaXamlLoader.Load(this);
|
|
|
|
public override void OnFrameworkInitializationCompleted()
|
|
{
|
|
if (ApplicationLifetime is IClassicDesktopStyleApplicationLifetime desktop)
|
|
{
|
|
// Verschlüsselte Datenbank (13.3.4): Passwort abfragen, bevor die Datenbank
|
|
// (und damit BuildServices, das sie öffnet) angefasst wird.
|
|
if (AppBootstrapper.IsDbEncrypted())
|
|
{
|
|
var promptVm = new DbPasswordPromptViewModel(
|
|
new DatabaseEncryptionService(), AppBootstrapper.ResolveDbPath());
|
|
var promptWindow = new DbPasswordPromptWindow { DataContext = promptVm };
|
|
promptVm.OnUnlocked = password =>
|
|
{
|
|
AppBootstrapper.DbPassword = password;
|
|
StartMainApp(desktop);
|
|
promptWindow.Close();
|
|
};
|
|
desktop.MainWindow = promptWindow;
|
|
}
|
|
else
|
|
{
|
|
StartMainApp(desktop);
|
|
}
|
|
}
|
|
|
|
base.OnFrameworkInitializationCompleted();
|
|
}
|
|
|
|
private static void StartMainApp(IClassicDesktopStyleApplicationLifetime desktop)
|
|
{
|
|
Services = AppBootstrapper.BuildServices();
|
|
Services.GetRequiredService<AppLogger>().Info("Anwendung gestartet.");
|
|
GlobalExceptionHandler.AttachNotifications(Services.GetRequiredService<NotificationService>());
|
|
|
|
var mainVm = Services.GetRequiredService<MainWindowViewModel>();
|
|
WireCallbacks(mainVm);
|
|
var main = new MainWindow { DataContext = mainVm };
|
|
desktop.MainWindow = main;
|
|
main.Show();
|
|
}
|
|
|
|
private static void WireCallbacks(MainWindowViewModel main)
|
|
{
|
|
// GroupList → GroupDetail (OnAddGroup wird in GroupListView.axaml.cs verdrahtet)
|
|
var gl = Services.GetRequiredService<GroupListViewModel>();
|
|
gl.OnNavigateToDetail = (id, tab) => main.NavigateToGroupDetail(id, tab);
|
|
|
|
// Dashboard → GroupDetail (Chips) / StudentDetail (Fehlzeiten-/Förderplan-Hinweise)
|
|
var dash = Services.GetRequiredService<DashboardViewModel>();
|
|
dash.OnNavigateToGroup = id => main.NavigateToGroupDetail(id);
|
|
dash.OnNavigateToStudent = id => main.NavigateToStudent(id);
|
|
|
|
// StudentList → StudentDetail + Anlegen
|
|
var sl = Services.GetRequiredService<StudentListViewModel>();
|
|
sl.OnNavigateToDetail = id => main.NavigateToStudent(id);
|
|
sl.OnAddStudent = () => ShowAddStudentDialog();
|
|
}
|
|
|
|
private static async Task ShowAddStudentDialog()
|
|
{
|
|
var vm = new ViewModels.Students.AddStudentDialogViewModel(
|
|
Services.GetRequiredService<Core.Interfaces.IStudentRepository>());
|
|
var dialog = new Views.Students.AddStudentDialog { DataContext = vm };
|
|
if (Application.Current?.ApplicationLifetime is IClassicDesktopStyleApplicationLifetime { MainWindow: { } owner })
|
|
await dialog.ShowDialog<bool>(owner);
|
|
}
|
|
}
|