public SettingsViewModel(IMediator mediator, SettingsManager settingsManager) { _mediator = mediator; _settingsManager = settingsManager; _oldSettings = _settingsManager.Settings.Clone(); UpdateCommand = new DelegateCommand(ExecuteUpdateCommand); SaveCommand = new DelegateCommand(ExecuteSaveCommand); CloseCommand = new DelegateCommand(ExecuteCloseCommand); }
public SettingsData DefaultSettings() { var defSettings = new SettingsData(); defSettings.CheckUpdatesOnLaunch = true; defSettings.MaxQuality = 0; defSettings.UpdateLocation = "http://apps.kristjanrang.eu/youdown/"; defSettings.TargetPath = DefaultTargetPath(); return defSettings; }
private void Load() { if (File.Exists(SettingsPath())) { var serializer = new XmlSerializer(typeof (SettingsData)); TextReader textReader = new StreamReader(SettingsPath()); try { Settings = (SettingsData) serializer.Deserialize(textReader); } catch { Settings = DefaultSettings(); } finally { textReader.Close(); } if (!Directory.Exists(Settings.TargetPath)) { Settings.TargetPath = DefaultTargetPath(); Save(); } } if (Settings == null) { Settings = DefaultSettings(); } }