Esempio n. 1
0
        public void SetConfigItem(string configKey, string configValue)
        {
            UserConfigItem cfgItem = new UserConfigItem()
            {
                ConfigKey   = configKey,
                ConfigValue = configValue
            };

            // Save or Update setting item
            SetConfigItem(cfgItem);
        }
Esempio n. 2
0
        // Methods ....................................................

        public string GetConfigItemValue(string configKey)
        {
            string itemValue = String.Empty;

            UserConfigItem cfgItem = ConfigItems.FirstOrDefault(s => s.ConfigKey == configKey);

            if (cfgItem != null)
            {
                itemValue = cfgItem.ConfigValue;
            }

            return(itemValue);
        }
Esempio n. 3
0
        private void SetConfigItem(UserConfigItem configItem)
        {
            // determine if the config item already exists
            UserConfigItem cfgItem = ConfigItems.FirstOrDefault(s => s.ConfigKey == configItem.ConfigKey);

            // Create or update
            if (cfgItem == null)
            {
                cfgItem = new UserConfigItem()
                {
                    ConfigKey   = configItem.ConfigKey,
                    ConfigValue = configItem.ConfigValue
                };

                // Add element to the list
                ConfigItems.Add(cfgItem);
            }
            else
            {
                // Update exiting element in list
                cfgItem.ConfigValue = configItem.ConfigValue;
            }
        }