Ejemplo n.º 1
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();
        }