@@ -50,22 +50,27 @@ namespace Elwig.Windows {
|
||||
_syncTimer.Start();
|
||||
}
|
||||
|
||||
private void Window_Closing(object sender, CancelEventArgs evt) {
|
||||
private async void Window_Closing(object sender, CancelEventArgs evt) {
|
||||
evt.Cancel = !App.ForceShutdown;
|
||||
|
||||
if (App.NumWindows > 1 && !App.ForceShutdown) {
|
||||
foreach (var w in App.Current.Windows.Cast<Window>().Where(w => ((w as AdministrationWindow)?.IsEditing ?? false) || ((w as AdministrationWindow)?.IsCreating ?? false))) {
|
||||
foreach (var w in Application.Current.Windows.Cast<Window>().Where(w => ((w as AdministrationWindow)?.IsEditing ?? false) || ((w as AdministrationWindow)?.IsCreating ?? false))) {
|
||||
try {
|
||||
w.Close();
|
||||
} catch { }
|
||||
}
|
||||
Thread.Sleep(100);
|
||||
if (App.NumWindows > 1 && !App.Current.Windows.Cast<Window>().Any(w => ((w as AdministrationWindow)?.IsEditing ?? false) || ((w as AdministrationWindow)?.IsCreating ?? false))) {
|
||||
if (App.NumWindows > 1 && !Application.Current.Windows.Cast<Window>().Any(w => ((w as AdministrationWindow)?.IsEditing ?? false) || ((w as AdministrationWindow)?.IsCreating ?? false))) {
|
||||
if (!InteractionService.AskConfirmation("Elwig beenden", "Es sind noch weitere Fenster geöffnet.\nSollen alle Fenster geschlossen werden?")) {
|
||||
evt.Cancel = true;
|
||||
} else {
|
||||
Application.Current.Shutdown();
|
||||
return;
|
||||
}
|
||||
App.ForceShutdown = true;
|
||||
}
|
||||
}
|
||||
|
||||
Mouse.OverrideCursor = Cursors.AppStarting;
|
||||
await (Application.Current as App)!.OnClosing();
|
||||
Application.Current.Shutdown();
|
||||
}
|
||||
|
||||
private void Menu_Help_About_Click(object sender, RoutedEventArgs evt) {
|
||||
@@ -180,6 +185,8 @@ namespace Elwig.Windows {
|
||||
try {
|
||||
var d = new OpenFileDialog() {
|
||||
Title = "Datenbank wiederherstellen - Elwig",
|
||||
DefaultDirectory = App.Config.BackupPath,
|
||||
InitialDirectory = App.Config.BackupPath,
|
||||
DefaultExt = "sql.zip",
|
||||
Filter = "SQLite-Datenbank (*.sqlite3, *.sqlite3.zip, *.sql, *.sql.zip)|*.sqlite3;*.sqlite3.zip;*.sql;*.sql.zip",
|
||||
};
|
||||
|
||||
Reference in New Issue
Block a user