internal void Merge(string idPrefix, ConfigWrapper configWrapper) { foreach (KeyValuePair <string, ConfigPropertyObject> pair in configWrapper.m_configValues) { string extendedParameterName = String.Format("{0}:{1}", idPrefix, pair.Key); if (ConfigValues.ContainsKey(extendedParameterName) == false) { var configValue = pair.Value; var property = new ConfigPropertyObject(extendedParameterName, configValue.Value, configValue.Type, configValue.AssemblyQualifiedName, configValue.IsEnum, configValue.DisplayName, configValue.Description); ConfigValues.Add(extendedParameterName, property); property.PropertyChanged += property_PropertyChanged; } } }
internal void AddProperty(ConfigPropertyObject propertyObject) { if (ConfigValues.ContainsKey(propertyObject.Name) == false) { //add Property to ConfigValues ConfigValues.Add(propertyObject.Name, propertyObject); //update also definition just for consistency if (m_configWrapperDefinition != null) { m_configWrapperDefinition.AddProperty(propertyObject); } } }
private void InitDefaultConfigWrapper() { ConfigValues.Clear(); if (m_configWrapperDefinition != null && m_configWrapperDefinition.Properties.Count > 0) { //init config values foreach (string propertyName in m_configWrapperDefinition.Properties.Keys) { var property = new ConfigPropertyObject(m_configWrapperDefinition.Properties[propertyName]); ConfigValues.Add(propertyName, property); property.PropertyChanged += property_PropertyChanged; } IsJava = m_configWrapperDefinition.IsJava; } }
/// <summary> /// Method that stes configuration values into ConfigValues List /// </summary> /// <param name="name">Configuration name</param> /// <param name="value">Value</param> private void SetConfigValues( string name, object value ) { var configValues = ConfigValues.Where(x => x.Key == name).SingleOrDefault(); if (configValues.IsDefault()) { ConfigValues.Add(name, value); } else { ConfigValues.Remove(name); ConfigValues.Add(name, value); } }
public void SetConfig(string configname, string domain, string username, string password, Uri endpoint, BindingType bindingType) { DeleteConfigValue(configname); ConfigValues.Add(new ConfigValue(configname, domain, username, password, endpoint, bindingType)); SaveConfig(); }