예제 #1
0
        /// <summary>
        /// Set custom color information
        /// </summary>
        /// <param name="verbalizerColor">The color category to set</param>
        /// <param name="color">The color to apply. Use <see langword="null"/>
        /// to revert to the default settings.</param>
        /// <param name="isBold">Whether or not to bold the font. Use <see langword="null"/> to revert to
        /// the default setting.</param>
        public void SetCustomColor(ORMDesignerColor verbalizerColor, Color?color, bool?isBold)
        {
            Dictionary <ORMDesignerColor, CategoryFontData> dict = myVerbalizationColors;
            CategoryFontData defaultData  = CategoryFontData.GetDefault(verbalizerColor);
            bool             defaultColor = !color.HasValue || defaultData.Color == color.Value;
            bool             defaultBold  = !isBold.HasValue || defaultData.IsBold == isBold.Value;

            if (defaultColor && defaultBold)
            {
                if (dict != null && dict.ContainsKey(verbalizerColor))
                {
                    dict.Remove(verbalizerColor);
                    if (dict.Count == 0)
                    {
                        myVerbalizationColors = null;
                    }
                }
            }
            else
            {
                if (dict == null)
                {
                    myVerbalizationColors = dict = new Dictionary <ORMDesignerColor, CategoryFontData>();
                }
                dict[verbalizerColor] = new CategoryFontData(defaultColor ? defaultData.Color : color.Value, defaultBold ? defaultData.IsBold : isBold.Value);
            }
        }
예제 #2
0
        /// <summary>
        /// Get whether a font is bolded for a verbalizer color category
        /// </summary>
        /// <param name="verbalizerColor">A designer color used for verbalization</param>
        /// <returns>Returns true if the color category is bolded.</returns>
        public bool GetIsBold(ORMDesignerColor verbalizerColor)
        {
            Dictionary <ORMDesignerColor, CategoryFontData> dict = myVerbalizationColors;
            CategoryFontData fontData;

            return((dict != null && dict.TryGetValue(verbalizerColor, out fontData)) ? fontData.IsBold : CategoryFontData.GetDefault(verbalizerColor).IsBold);
        }