private void SaveUserPrefs() { var prefSaver = new PrefSaver(); if (prefSaver.CheckForPrefs()) { var prefs = prefSaver.LoadPrefs(); prefs.MaxBackups = MaxBackups; prefs.SelectedGames = GamesToBackup; prefs.LastBackupTime = LastBackupTime; prefs.BackupSyncOptions = BackupSyncOptions; prefs.ThemeName = _themeName; prefSaver.SavePrefs(prefs); return; } var newPrefs = new UserPrefs() { BackupSyncOptions = BackupSyncOptions, LastBackupTime = LastBackupTime, MaxBackups = MaxBackups, SelectedGames = GamesToBackup, }; prefSaver.SavePrefs(newPrefs); }
private void SetUpInterface() { var prefSaver = new PrefSaver(); var prefs = prefSaver.CheckForPrefs() ? prefSaver.LoadPrefs() : UserPrefs.GetDefaultPrefs(); MaxBackups = prefs.MaxBackups; LastBackupTime = prefs.LastBackupTime; BackupSyncOptions = prefs.BackupSyncOptions ?? new BackupSyncOptions(); GamesToBackup = prefs.SelectedGames ?? new ObservableCollection<Game>(); _themeName = prefs.ThemeName; AutoBackupVisibility = Visibility.Hidden; if (string.IsNullOrEmpty(_themeName)) _themeName = @"DarkStyle.xaml"; ChangeTheme(_themeName); }