private void RemoveLocation() { if (SelectedLocation != null) { BackupLocations.Remove(SelectedLocation); SaveSettings(); } }
private void AddLocation() { var folderBrowser = new VistaFolderBrowserDialog(); if (folderBrowser.ShowDialog() == true) { BackupLocations.Add(new BackupLocation(folderBrowser.SelectedPath)); SaveSettings(); } }
private void LoadSettings() { if (!File.Exists(SETTINGS_PATH)) { foreach (var defaultPath in DEFAULT_PATHS) { BackupLocations.Add(new BackupLocation(defaultPath)); } } else { BackupLocations = new ObservableCollection <BackupLocation>(XmlHelper.FromXML <List <BackupLocation> >(File.ReadAllText(SETTINGS_PATH))); } }
private void SaveSettings() { if (!Directory.Exists(SETTINGS_DIR)) { Directory.CreateDirectory(SETTINGS_DIR); } if (File.Exists(SETTINGS_PATH)) { File.Copy(SETTINGS_PATH, SETTINGS_PATH_BAK, true); } File.WriteAllText(SETTINGS_PATH, XmlHelper.ToXML(BackupLocations.ToList())); }