Ejemplo n.º 1
0
        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);
        }
Ejemplo n.º 2
0
        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;
        }
Ejemplo n.º 3
0
        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();
            }
        }