예제 #1
0
        public virtual void Save(IFrontEndSettingsService settingsService)
        {
            // 5 load existing settings for this type
            var settings = new List <Setting>();

            foreach (var propertyInfo in _properties)
            {
                object propertyValue = propertyInfo.GetValue(this, null);
                string value         = (propertyValue == null) ? null : propertyValue.ToString();

                // 7 create new setting
                var newSetting = new Setting()
                {
                    Name  = propertyInfo.Name,
                    Type  = _name,
                    Value = value,
                };

                settings.Add(newSetting);
            }

            if (settings != null && settings.Count > 0)
            {
                settingsService.SaveFrontEndSettings(settings);
            }
        }
예제 #2
0
        private T CreateFrontEndSettings <T>(IFrontEndSettingsService settingsService, bool useCache) where T : FrontEndSettingsBase, new()
        {
            var settings = new T();

            settings.Load(settingsService, useCache);
            return(settings);
        }
예제 #3
0
 public void Save(IFrontEndSettingsService settingsService)
 {
     if (_generalFrontEndSettings != null)
     {
         _generalFrontEndSettings.Save(settingsService);
     }
 }
예제 #4
0
 public void Save(string settingTypeName, IFrontEndSettingsService settingsService)
 {
     if (_generalFrontEndSettings != null && _generalFrontEndSettings.GetType().Name == settingTypeName)
     {
         _generalFrontEndSettings.Save(settingsService);
         return;
     }
 }
예제 #5
0
        public virtual void Load(IFrontEndSettingsService settingsService, bool useCache)
        {
            // ARGUMENT CHECKING SKIPPED FOR BREVITY
            // 3 get settings for this type name
            var settings = settingsService.LoadFrontEndSettings(this._name, useCache).Result;

            if (settings != null && settings.Count > 0)
            {
                foreach (var propertyInfo in _properties)
                {
                    // get the setting from the settings list
                    var setting = settings.SingleOrDefault(s => s.Name == propertyInfo.Name);
                    if (setting != null)
                    {
                        // 4 assign the setting values to the properties in the type inheriting this class
                        propertyInfo.SetValue(this, Convert.ChangeType(setting.Value, propertyInfo.PropertyType));
                    }
                }
            }
        }
예제 #6
0
 public FrontEndSystemController(IFrontEndSettingsService settingService, IActivityStore activityStore)
 {
     _frontSettingService = settingService;
     _activityStore       = activityStore;
 }
예제 #7
0
 public void Load(IFrontEndSettingsService settingsService, bool useCache = false)
 {
     _generalFrontEndSettings = CreateFrontEndSettings <GeneralFrontEndSettings>(settingsService, useCache);
 }