/// <summary> /// The update extended attribute configuration. /// </summary> /// <param name="attributeName"> /// The attribute name. /// </param> /// <param name="zipEntry"> /// The zip entry. /// </param> private void UpdateExtendedAttributeConfiguration(string attributeName, ZipEntry zipEntry) { if (!this.attributeConfigurations.ContainsKey(attributeName)) { return; } MemoryStream ms = new MemoryStream(); zipEntry.Extract(ms); ms.Position = 0; using (StreamReader streamReader = new StreamReader(ms)) { CsvReader csvReader = new CsvReader(streamReader); IEnumerable <AttributeExtendedConfiguration> records = csvReader.GetRecords <AttributeExtendedConfiguration>(); foreach (AttributeExtendedConfiguration attributeExtConfiguration in records) { this.attributeConfigurations[attributeName].SetAttributeValueColor( attributeExtConfiguration.Value, CustomColorConverter.StringToColor(attributeExtConfiguration.Color)); this.attributeConfigurations[attributeName].SetAttributeValueVisibility( attributeExtConfiguration.Value, attributeExtConfiguration.Visibility); } } }
/// <summary> /// Gets color for attribute's value. /// </summary> /// <param name="value"> /// Attribute's value. /// </param> /// <returns> /// The color. /// </returns> public Color GetAttributeValueColor(object value) { string strValue = value == null ? string.Empty : value.ToString(); if (Colors.ContainsKey(strValue)) { return CustomColorConverter.StringToColor(Colors[strValue]); } return GetDefaultColor(value); }
/// <summary> /// Gets color of calendar state /// </summary> /// <returns>the color</returns> public Color GetColor() { return(CustomColorConverter.StringToColor(CalendarStateColor)); }
/// <summary> /// The load extended attribute configuration. /// </summary> private void LoadExtendedAttributeConfiguration() { foreach (string attributeName in this.attributeConfigurations.Keys) { string extAttributePath = Path.Combine(this.ConfigurationFolder, string.Format(AttributeExtendedConfigurationFile, attributeName)); if (this.FileExists(extAttributePath)) { using (StreamReader streamReader = new StreamReader(this.GetFileStream(extAttributePath, FileMode.Open))) { CsvReader csvReader = new CsvReader(streamReader); IEnumerable <AttributeExtendedConfiguration> records = csvReader.GetRecords <AttributeExtendedConfiguration>(); foreach (AttributeExtendedConfiguration attributeExtendedConfiguration in records) { this.attributeConfigurations[attributeName].SetAttributeValueColor(attributeExtendedConfiguration.Value, CustomColorConverter.StringToColor(attributeExtendedConfiguration.Color)); this.attributeConfigurations[attributeName].SetAttributeValueVisibility(attributeExtendedConfiguration.Value, attributeExtendedConfiguration.Visibility); } } } } }