示例#1
0
        //define the actions to take when the event is raised
        public void AddCalculations(object sender, CustomEventArgs e)
        {
            //pass a byref xelement from the publisher's data
            XElement statElement       = null;
            XElement linkedViewElement = null;

            if (e.CurrentElement != null)
            {
                statElement = new XElement(e.CurrentElement);
            }
            if (e.LinkedViewElement != null)
            {
                linkedViewElement = new XElement(e.LinkedViewElement);
            }
            SB1CalculatorHelper.CALCULATOR_TYPES eCalculatorType
                = SB1CalculatorHelper.GetCalculatorType(
                      this.GCCalculatorParams.CalculatorType);
            if (eCalculatorType == SB1CalculatorHelper.CALCULATOR_TYPES.sb101 ||
                eCalculatorType == SB1CalculatorHelper.CALCULATOR_TYPES.sb102)
            {
                //only ios use calculators -remaining base elements just run analyses
            }
            else
            {
                //run normally and save the same statelement and linkedviewelement
                e.HasCalculations = RunSB1Analysis(
                    statElement, linkedViewElement);
            }
            if (e.HasCalculations)
            {
                //pass the new statelement back to the publisher
                //by setting the CalculatedElement property of CustomEventArgs
                if (statElement != null)
                {
                    e.CurrentElement = new XElement(statElement);
                }
                if (linkedViewElement != null)
                {
                    e.LinkedViewElement = new XElement(linkedViewElement);
                }
            }
        }