コード例 #1
0
        public CustomColor Add(string name)
        {
            CustomColor customColor = new CustomColor();

            customColor.Name = name;
            Add(customColor);
            return(customColor);
        }
コード例 #2
0
        public override object GetValue(object component)
        {
            CustomColor customColor = (CustomColor)component;

            if (Name == "FromValue")
            {
                return(field.Parse(customColor.FromValue));
            }
            return(field.Parse(customColor.ToValue));
        }
コード例 #3
0
 internal void ApplyCustomColorAttributes(CustomColor customColor)
 {
     UseInternalProperties = true;
     BorderColorInt        = customColor.BorderColor;
     ColorInt          = customColor.Color;
     SecondaryColorInt = customColor.SecondaryColor;
     GradientTypeInt   = customColor.GradientType;
     HatchStyleInt     = customColor.HatchStyle;
     TextInt           = customColor.Text;
     ToolTipInt        = customColor.ToolTip;
 }
コード例 #4
0
        public override void SetValue(object component, object value)
        {
            CustomColor customColor = (CustomColor)component;

            if (Name == "FromValue")
            {
                customColor.FromValue = Field.ToStringInvariant(value);
            }
            else
            {
                customColor.ToValue = Field.ToStringInvariant(value);
            }
        }
コード例 #5
0
        internal override void RegenerateRanges()
        {
            if (UseCustomColors)
            {
                foreach (CustomColor customColor9 in CustomColors)
                {
                    customColor9.AffectedElements.Clear();
                }
            }
            MapCore mapCore = GetMapCore();

            if (mapCore == null || mapCore.Paths.Count == 0 || (UseCustomColors && CustomColors.Count == 0))
            {
                return;
            }
            if (!UseCustomColors)
            {
                CustomColors.Clear();
            }
            if (base.PathField == "(Name)")
            {
                if (UseCustomColors)
                {
                    int num = 0;
                    foreach (Path path4 in mapCore.Paths)
                    {
                        if (num == CustomColors.Count)
                        {
                            break;
                        }
                        CustomColor customColor = CustomColors[num++];
                        customColor.FromValueInt = path4.Name;
                        customColor.ToValueInt   = path4.Name;
                    }
                }
                else
                {
                    Color[] colors = GetColors(ColoringMode, ColorPalette, FromColor, MiddleColor, ToColor, mapCore.Paths.Count);
                    int     num2   = 0;
                    foreach (Path path5 in mapCore.Paths)
                    {
                        if (path5.Category == Category)
                        {
                            CustomColor customColor2 = CustomColors.Add(string.Empty);
                            customColor2.Color          = colors[num2++];
                            customColor2.SecondaryColor = SecondaryColor;
                            customColor2.BorderColor    = BorderColor;
                            customColor2.GradientType   = GradientType;
                            customColor2.HatchStyle     = HatchStyle;
                            customColor2.FromValueInt   = path5.Name;
                            customColor2.ToValueInt     = path5.Name;
                            customColor2.Text           = base.Text;
                            customColor2.ToolTip        = base.ToolTip;
                        }
                    }
                }
                UpdateColorSwatchAndLegend();
                return;
            }
            Field field = GetField();

            if (field == null)
            {
                return;
            }
            if (field.IsNumeric())
            {
                int    intervalCount = (!UseCustomColors) ? ColorCount : CustomColors.Count;
                object obj           = null;
                object obj2          = null;
                if (FromValue != string.Empty)
                {
                    obj = field.Parse(FromValue);
                }
                if (ToValue != string.Empty)
                {
                    obj2 = field.Parse(ToValue);
                }
                if (obj == null || obj2 == null)
                {
                    GetRangeFromPaths(field, intervalCount, ref obj, ref obj2);
                }
                object[] fromValues = null;
                object[] toValues   = null;
                if (DataGrouping == DataGrouping.EqualInterval)
                {
                    GetEqualIntervals(field, obj, obj2, intervalCount, ref fromValues, ref toValues);
                }
                else if (DataGrouping == DataGrouping.EqualDistribution)
                {
                    ArrayList sortedValues = GetSortedValues(field, obj, obj2);
                    GetEqualDistributionIntervals(field, sortedValues, obj, obj2, intervalCount, ref fromValues, ref toValues);
                }
                else if (DataGrouping == DataGrouping.Optimal)
                {
                    ArrayList sortedValues2 = GetSortedValues(field, obj, obj2);
                    GetOptimalIntervals(field, sortedValues2, obj, obj2, intervalCount, ref fromValues, ref toValues);
                }
                if (UseCustomColors)
                {
                    int num3 = 0;
                    foreach (CustomColor customColor10 in CustomColors)
                    {
                        if (num3 < fromValues.Length)
                        {
                            customColor10.FromValueInt = Microsoft.Reporting.Map.WebForms.Field.ToStringInvariant(fromValues[num3]);
                            customColor10.ToValueInt   = Microsoft.Reporting.Map.WebForms.Field.ToStringInvariant(toValues[num3]);
                            customColor10.VisibleInt   = true;
                        }
                        else
                        {
                            customColor10.FromValueInt = Microsoft.Reporting.Map.WebForms.Field.ToStringInvariant(toValues[toValues.Length - 1]);
                            customColor10.ToValueInt   = Microsoft.Reporting.Map.WebForms.Field.ToStringInvariant(toValues[toValues.Length - 1]);
                            customColor10.VisibleInt   = false;
                        }
                        num3++;
                    }
                }
                else
                {
                    Color[] colors2 = GetColors(ColoringMode, ColorPalette, FromColor, MiddleColor, ToColor, fromValues.Length);
                    for (int i = 0; i < fromValues.Length; i++)
                    {
                        CustomColor customColor4 = CustomColors.Add(string.Empty);
                        customColor4.Color          = colors2[i];
                        customColor4.SecondaryColor = SecondaryColor;
                        customColor4.BorderColor    = BorderColor;
                        customColor4.GradientType   = GradientType;
                        customColor4.HatchStyle     = HatchStyle;
                        customColor4.FromValueInt   = Microsoft.Reporting.Map.WebForms.Field.ToStringInvariant(fromValues[i]);
                        customColor4.ToValueInt     = Microsoft.Reporting.Map.WebForms.Field.ToStringInvariant(toValues[i]);
                        customColor4.Text           = base.Text;
                        customColor4.ToolTip        = base.ToolTip;
                    }
                }
            }
            else if (field.Type == typeof(string))
            {
                Hashtable hashtable = new Hashtable();
                foreach (Path path6 in GetMapCore().Paths)
                {
                    if (path6.Category == Category)
                    {
                        string text = (string)path6[field.Name];
                        if (text != null)
                        {
                            hashtable[text] = 0;
                        }
                    }
                }
                if (UseCustomColors)
                {
                    ArrayList arrayList = new ArrayList();
                    arrayList.AddRange(hashtable.Keys);
                    arrayList.Sort();
                    int num4 = 0;
                    foreach (object item in arrayList)
                    {
                        if (num4 == CustomColors.Count)
                        {
                            break;
                        }
                        CustomColor customColor5 = CustomColors[num4++];
                        customColor5.FromValueInt = (string)item;
                        customColor5.ToValueInt   = (string)item;
                    }
                }
                else
                {
                    Color[] colors3 = GetColors(ColoringMode, ColorPalette, FromColor, MiddleColor, ToColor, hashtable.Keys.Count);
                    int     num5    = 0;
                    foreach (object key in hashtable.Keys)
                    {
                        CustomColor customColor6 = CustomColors.Add(string.Empty);
                        customColor6.Color          = colors3[num5++];
                        customColor6.SecondaryColor = SecondaryColor;
                        customColor6.BorderColor    = BorderColor;
                        customColor6.GradientType   = GradientType;
                        customColor6.HatchStyle     = HatchStyle;
                        customColor6.FromValueInt   = (string)key;
                        customColor6.ToValueInt     = (string)key;
                        customColor6.Text           = base.Text;
                        customColor6.ToolTip        = base.ToolTip;
                    }
                }
            }
            else if (UseCustomColors)
            {
                CustomColors[0].FromValueInt = "False";
                CustomColors[0].ToValueInt   = "False";
                if (CustomColors.Count > 1)
                {
                    CustomColors[1].FromValueInt = "True";
                    CustomColors[1].ToValueInt   = "True";
                }
            }
            else
            {
                CustomColor customColor7 = CustomColors.Add(string.Empty);
                customColor7.Color          = FromColor;
                customColor7.SecondaryColor = SecondaryColor;
                customColor7.BorderColor    = BorderColor;
                customColor7.GradientType   = GradientType;
                customColor7.HatchStyle     = HatchStyle;
                customColor7.FromValueInt   = "False";
                customColor7.ToValueInt     = "False";
                customColor7.Text           = base.Text;
                customColor7.ToolTip        = base.ToolTip;
                CustomColor customColor8 = CustomColors.Add(string.Empty);
                customColor8.Color          = ToColor;
                customColor8.SecondaryColor = SecondaryColor;
                customColor8.BorderColor    = BorderColor;
                customColor8.GradientType   = GradientType;
                customColor8.HatchStyle     = HatchStyle;
                customColor8.FromValueInt   = "True";
                customColor8.ToValueInt     = "True";
                customColor8.Text           = base.Text;
                customColor8.ToolTip        = base.ToolTip;
            }
            UpdateColorSwatchAndLegend();
        }
コード例 #6
0
 public void Remove(CustomColor value)
 {
     base.List.Remove(value);
 }
コード例 #7
0
 public int Add(CustomColor value)
 {
     return(base.List.Add(value));
 }
コード例 #8
0
 private Field GetField(CustomColor customColor)
 {
     return(customColor?.GetRule()?.GetField());
 }