private void ResetSettings() { try { _settings = WindowManagerSettings.Load(); } catch (Exception) { _settings = WindowManagerSettings.GetDefault(); _settings.Save(); } _settingsGrid.DataContext = _settings; if (_hotKeyManager != null) { _hotKeyManager.Dispose(); _hotKeyManager = null; } WindowManagerSettings s = _settings.Clone(); _hotKeyManager = new HotKeyManager(s); if (_hotKeyManager.Errors.Any()) { MessageBox.Show(_hotKeyManager.Errors.Aggregate((buff, a) => buff + "\n" + a), "Error", MessageBoxButton.OK, MessageBoxImage.Error); } }
private void DefaultSettingsClick(object sender, RoutedEventArgs e) { var firstStart = _settings.FirstStart; _settings = WindowManagerSettings.GetDefault(); _settings.FirstStart = firstStart; _settings.Save(); ResetSettings(); }