private void OnWindowClosing(CancelEventArgs args) { foreach (var tab in TabItems) { if (!(tab.Content is MappingsView)) { continue; } var content = (MappingsView)tab.Content; var context = (MappingsViewModel)content.DataContext; context.UpdateSettings(); break; } try { var unused = App.Client.SetSettings(Model.Settings); } catch (Exception e) { _logger.Fatal(e.Message); } if (!Cancel) { Cleanup(); // removes Messenger bindings return; // closes Window } args.Cancel = true; Win.Hide(); }
private void OnWindowClosing(CancelEventArgs args) { // (Konrad) If Remote Settings were used // We should not be saving them locally but make sure that Startup is up to date. if (!Settings.StoreSettings) { RegistryUtils.SetStartup(Settings); if (!Cancel) { Cleanup(); // removes Messenger bindings return; // closes Window } args.Cancel = true; Win.Hide(); return; } foreach (var tab in TabItems) { if (!(tab.Content is MappingsView)) { continue; } var content = (MappingsView)tab.Content; var context = (MappingsViewModel)content.DataContext; context.UpdateSettings(); break; } Model.StoreSettings(Settings, Settings.SettingsLocation); RegistryUtils.SetStartup(Settings); if (!Cancel) { Cleanup(); // removes Messenger bindings return; // closes Window } args.Cancel = true; Win.Hide(); }