Esempio n. 1
0
 internal static ApplicationSettings CreateDefault()
 {
     ApplicationSettings settings = new ApplicationSettings();
     settings._dateTo = DateTime.Now.Date;
     settings._dateFrom = settings._dateTo.AddDays(-6);
     return settings;
 }
Esempio n. 2
0
        public void SaveAppSettings(ApplicationSettings settings)
        {
            string fullFileName = Path.Combine(SettingsDataDirectory, ApplicationSettingsFileName);

            XmlSerializer ser = new XmlSerializer(typeof(ApplicationSettings));
            using (TextWriter writer = new StreamWriter(fullFileName, false))
            {
                ser.Serialize(writer, settings);
                writer.Close();
            }
        }
Esempio n. 3
0
        private void Init()
        {
            CalcVersionString();
            _fileHelper.MoveDeployedRecources();
            _applicationSettings = _fileHelper.LoadAppSettings();
            if (_applicationSettings == null)
                _applicationSettings = ApplicationSettings.CreateDefault();

            _configurations = new ObservableCollection<ModelSettings>();
            IEnumerable<ModelSettings> loaded = _fileHelper.LoadAllSettings();
            foreach (var setting in loaded)
            {
                _configurations.Add(setting);
            }

            ModelSettings active = loaded.FirstOrDefault(x=>x.FileName == _applicationSettings.ConfigurationFile);
            if (active != null)
                ActiveConfigutaion = active;
        }