[#56] Windows: Fail gracefully while saving
All checks were successful
Test / Run tests (push) Successful in 2m11s

This commit is contained in:
2024-09-23 22:51:01 +02:00
parent 94a6dd5312
commit ce39797d8b
8 changed files with 141 additions and 65 deletions

View File

@ -226,14 +226,22 @@ namespace Elwig.Windows {
}
private async void AreaCommitmentSaveButton_Click(object? sender, RoutedEventArgs? evt) {
int? fbnr = null;
AreaCommitmentSaveButton.IsEnabled = false;
Mouse.OverrideCursor = Cursors.AppStarting;
int fbnr;
try {
fbnr = await ViewModel.UpdateAreaCommitment((AreaCommitmentList.SelectedItem as AreaCom)?.FbNr);
} catch (Exception exc) {
var str = "Der Eintrag konnte nicht in der Datenbank aktualisiert werden!\n\n" + exc.Message;
if (exc.InnerException != null) str += "\n\n" + exc.InnerException.Message;
MessageBox.Show(str, "Flächenbindung aktualisieren", MessageBoxButton.OK, MessageBoxImage.Error);
AreaCommitmentSaveButton.IsEnabled = true;
return;
} finally {
Mouse.OverrideCursor = null;
}
IsEditing = false;
IsCreating = false;
AreaCommitmentList.IsEnabled = true;