Ejemplo n.º 1
0
 public ReportColor(AspNetCore.ReportingServices.ReportRendering.ReportColor oldColor)
 {
     this.m_color  = oldColor.ToString();
     this.m_parsed = oldColor.Parsed;
     if (this.m_parsed)
     {
         this.m_GDIColor = oldColor.ToColor();
     }
 }
Ejemplo n.º 2
0
        public void SetStyle(Style.StyleName style, object value, bool isShared)
        {
            object obj  = null;
            bool   flag = false;

            switch (style)
            {
            case Style.StyleName.BorderColor:
            case Style.StyleName.BorderColorTop:
            case Style.StyleName.BorderColorLeft:
            case Style.StyleName.BorderColorRight:
            case Style.StyleName.BorderColorBottom:
            case Style.StyleName.BackgroundColor:
            case Style.StyleName.Color:
                if (value is ReportColor)
                {
                    obj = (value as ReportColor);
                }
                else if (value is string)
                {
                    obj = new ReportColor(value as string);
                }
                if (obj == null)
                {
                    throw new ReportRenderingException(ErrorCode.rrInvalidStyleArgumentType, "ReportColor");
                }
                obj  = ((ReportColor)obj).ToString();
                flag = true;
                break;

            case Style.StyleName.BorderStyle:
            case Style.StyleName.BorderStyleTop:
            case Style.StyleName.BorderStyleLeft:
            case Style.StyleName.BorderStyleRight:
            case Style.StyleName.BorderStyleBottom:
                if (value != null)
                {
                    obj = (value as string);
                    if (obj == null)
                    {
                        throw new ReportRenderingException(ErrorCode.rrInvalidStyleArgumentType, "String");
                    }
                    string text = default(string);
                    if (!Validator.ValidateBorderStyle(obj as string, out text))
                    {
                        throw new ReportRenderingException(ErrorCode.rrInvalidBorderStyle, obj);
                    }
                }
                flag = true;
                break;

            case Style.StyleName.BorderWidth:
            case Style.StyleName.BorderWidthTop:
            case Style.StyleName.BorderWidthLeft:
            case Style.StyleName.BorderWidthRight:
            case Style.StyleName.BorderWidthBottom:
            case Style.StyleName.FontSize:
            case Style.StyleName.PaddingLeft:
            case Style.StyleName.PaddingRight:
            case Style.StyleName.PaddingTop:
            case Style.StyleName.PaddingBottom:
            case Style.StyleName.LineHeight:
                if (value is ReportSize)
                {
                    obj = (value as ReportSize);
                }
                else if (value is string)
                {
                    obj = new ReportSize(value as string);
                }
                if (obj == null)
                {
                    throw new ReportRenderingException(ErrorCode.rrInvalidStyleArgumentType, "ReportSize");
                }
                flag = true;
                break;

            case Style.StyleName.NumeralVariant:
            {
                int num = default(int);
                if (!int.TryParse(value as string, out num))
                {
                    throw new ReportRenderingException(ErrorCode.rrInvalidStyleArgumentType, "Int32");
                }
                obj  = num;
                flag = true;
                break;
            }

            default:
                if (value != null)
                {
                    obj = (value as string);
                    if (obj == null)
                    {
                        throw new ReportRenderingException(ErrorCode.rrInvalidStyleArgumentType, "String");
                    }
                }
                flag = true;
                break;
            }
            if (flag)
            {
                if (isShared)
                {
                    if (this.m_sharedProperties == null)
                    {
                        this.m_sharedProperties = new StyleProperties();
                    }
                    this.m_sharedProperties.Set(style.ToString(), obj);
                }
                else
                {
                    if (this.m_nonSharedProperties == null)
                    {
                        this.m_nonSharedProperties = new StyleProperties();
                    }
                    this.m_nonSharedProperties.Set(style.ToString(), obj);
                }
            }
        }