示例#1
0
 public override void Init()
 {
     for (int i = 0; i < this.RowNumber; i++)
     {
         for (int j = 0; j < this.ColumnNumber; j++)
         {
             string cellElement = this.GetCellElement(i, j);
             if ((cellElement.Length != 0) && (cellElement[0] == '='))
             {
                 ExpressionCalculator calculator = new ExpressionCalculator();
                 calculator.Init(cellElement.Substring(1));
                 for (int k = 0; k < calculator.ParamList.Count; k++)
                 {
                     string           str2  = calculator.ParamList.Keys[k];
                     MapTemplateParam param = base.MapTemplate.FindParamByName(str2);
                     if (param != null)
                     {
                         calculator.ParamList[str2] = param.Value;
                     }
                 }
                 object       obj2    = calculator.Calculate();
                 ITextElement element = (this.Element as ITableElement).GetCellElement(i, j) as ITextElement;
                 if (element != null)
                 {
                     element.Text = obj2.ToString();
                 }
             }
         }
     }
 }
示例#2
0
 public override void Init()
 {
     if (this.Text[0] == '=')
     {
         ExpressionCalculator calculator = new ExpressionCalculator();
         calculator.Init(this.Text.Substring(1));
         for (int i = 0; i < calculator.ParamList.Count; i++)
         {
             string           str   = calculator.ParamList.Keys[i];
             MapTemplateParam param = base.MapTemplate.FindParamByName(str);
             if (param != null)
             {
                 calculator.ParamList[str] = param.Value;
             }
         }
         object obj2 = calculator.Calculate();
         if (obj2 == null)
         {
             (base.m_pElement as ITextElement).Text = "";
         }
         else
         {
             string str2 = obj2.ToString();
             if (str2.Length == 0)
             {
                 str2 = " ";
             }
             this.Text = str2;
             (base.m_pElement as ITextElement).Text = obj2.ToString();
         }
     }
 }
示例#3
0
        public override void Init()
        {
            IElement             element;
            string               text;
            ExpressionCalculator calculator;
            int              num2;
            string           str2;
            MapTemplateParam param;

            for (int i = 0; i < this.igroupElement_0.ElementCount; i++)
            {
                element = this.igroupElement_0.get_Element(i);
                if (element is ITextElement)
                {
                    text = (element as ITextElement).Text;
                    if ((text.Length != 0) && (text[0] == '='))
                    {
                        calculator = new ExpressionCalculator();
                        calculator.Init(text.Substring(1));
                        num2 = 0;
                        while (num2 < calculator.ParamList.Count)
                        {
                            str2  = calculator.ParamList.Keys[num2];
                            param = base.MapTemplate.FindParamByName(str2);
                            if (param != null)
                            {
                                calculator.ParamList[str2] = param.Value;
                            }
                            num2++;
                        }
                        string str3 = calculator.Calculate().ToString();
                        if (str3 == "")
                        {
                            str3 = "  ";
                        }
                        (element as ITextElement).Text = str3;
                        (this.igroupElement_0 as IGroupElement3).ReplaceElement(element, element);
                    }
                }
            }
            IEnumElement elements = (base.m_pElement as IGroupElement).Elements;

            elements.Reset();
            for (element = elements.Next(); element != null; element = elements.Next())
            {
                if (element is ITextElement)
                {
                    text = (element as ITextElement).Text;
                    if ((text.Length > 0) && (text[0] == '='))
                    {
                        calculator = new ExpressionCalculator();
                        calculator.Init(text.Substring(1));
                        for (num2 = 0; num2 < calculator.ParamList.Count; num2++)
                        {
                            str2  = calculator.ParamList.Keys[num2];
                            param = base.MapTemplate.FindParamByName(str2);
                            if (param != null)
                            {
                                calculator.ParamList[str2] = param.Value;
                            }
                        }
                        (element as ITextElement).Text = calculator.Calculate().ToString();
                    }
                }
            }
            base.Init();
        }