App: Add ShutdownNow() and ShutdownGracefully()
This commit is contained in:
@@ -108,12 +108,20 @@ namespace Elwig.Windows {
|
||||
LockInputs();
|
||||
}
|
||||
|
||||
public void TryClose() {
|
||||
var evt = new CancelEventArgs();
|
||||
OnClosing(this, evt);
|
||||
if (!evt.Cancel) Close();
|
||||
}
|
||||
|
||||
private void OnClosing(object? sender, CancelEventArgs evt) {
|
||||
if ((IsCreating || IsEditing) && HasChanged) {
|
||||
if (!InteractionService.AskConfirmation("Schließen bestätigen", "Soll das Fenster wirklich geschlossen werden?")) {
|
||||
evt.Cancel = true;
|
||||
return;
|
||||
}
|
||||
if (!IsClosing && (IsCreating || IsEditing) && HasChanged) {
|
||||
try {
|
||||
if (!InteractionService.AskConfirmation("Schließen bestätigen", "Soll das Fenster wirklich geschlossen werden?")) {
|
||||
evt.Cancel = true;
|
||||
return;
|
||||
}
|
||||
} catch { }
|
||||
}
|
||||
IsClosing = true;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user