Fehlerbehandlung, Logging und feldbezogene Validierung (Kapitel 13.2)
Zentrale Exception-Behandlung (Dispatcher.UIThread.UnhandledException, AppDomain, TaskScheduler) verhindert Abstürze und protokolliert Fehler über AppLogger in eine rotierende Log-Datei im App-Datenverzeichnis. Toast-Benachrichtigungen zeigen Erfolg/Fehler global an. Alle Dialoge mit Formularfeldern zeigen Validierungsmeldungen jetzt direkt am betroffenen Feld statt in einem Sammel-Label. Co-Authored-By: Claude Sonnet 5 <noreply@anthropic.com>
This commit is contained in:
@@ -671,7 +671,7 @@ public partial class AddSessionDialogViewModel : ObservableObject
|
||||
[ObservableProperty] private DateOnly _date = DateOnly.FromDateTime(DateTime.Today);
|
||||
[ObservableProperty] private string _comment = "";
|
||||
[ObservableProperty] private string _dateText = DateOnly.FromDateTime(DateTime.Today).ToString("dd.MM.yyyy");
|
||||
[ObservableProperty] private string _validationMessage = "";
|
||||
[ObservableProperty] private string _dateTextError = "";
|
||||
|
||||
public ParticipationSession? Result { get; private set; }
|
||||
|
||||
@@ -681,9 +681,10 @@ public partial class AddSessionDialogViewModel : ObservableObject
|
||||
if (!DateOnly.TryParseExact(DateText, "dd.MM.yyyy", null,
|
||||
System.Globalization.DateTimeStyles.None, out var date))
|
||||
{
|
||||
ValidationMessage = "Datum im Format TT.MM.JJJJ eingeben.";
|
||||
DateTextError = "Format TT.MM.JJJJ.";
|
||||
return;
|
||||
}
|
||||
DateTextError = "";
|
||||
Result = new ParticipationSession { Date = date, Comment = Comment.Trim() };
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user