コード例 #1
0
        //allows derived classes to override the method
        protected virtual async Task <bool> RunCalculationAsync(XElement currentElement, XElement linkedViewElement)
        {
            bool bHasCalculations = false;

            SB1CalculatorHelper.CALCULATOR_TYPES eCalculatorType
                = SB1CalculatorHelper.GetCalculatorType(
                      this.GCCalculatorParams.CalculatorType);
            switch (eCalculatorType)
            {
            case SB1CalculatorHelper.CALCULATOR_TYPES.sb101:
                //serialize, run calcs, and deserialize
                SBC1Calculator sbc1 = new SBC1Calculator();
                bHasCalculations = await sbc1.SetSB1C1CalculationsAsync(eCalculatorType, this.GCCalculatorParams,
                                                                        linkedViewElement, currentElement);

                break;

            case SB1CalculatorHelper.CALCULATOR_TYPES.sb102:
                //serialize, run calcs, and deserialize
                SBB1Calculator sbb1 = new SBB1Calculator();
                bHasCalculations = await sbb1.SetSB1B1CalculationsAsync(eCalculatorType, this.GCCalculatorParams,
                                                                        linkedViewElement, currentElement);

                break;

            default:
                //should be running an analysis
                break;
            }
            return(bHasCalculations);
        }
コード例 #2
0
ファイル: SB1.cs プロジェクト: kpboyle1/devtreks
 private static void CheckForLastStepCalculator(
     CalculatorParameters sb1CalcParams,
     ContractHelpers.EXTENSION_STEPS stepNumber,
     ExtensionContentURI extDocToCalcURI)
 {
     SB1CalculatorHelper.CALCULATOR_TYPES eCalculatorType
         = SB1CalculatorHelper.GetCalculatorType(
               sb1CalcParams.CalculatorType);
     //other projects have code for handling different
     //numbers of steps in calculators
 }
コード例 #3
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);
            }
            //run the stats and add them to statelement
            SB1CalculatorHelper.CALCULATOR_TYPES eCalculatorType
                = SB1CalculatorHelper.GetCalculatorType(
                      this.GCCalculatorParams.CalculatorType);
            if (eCalculatorType == SB1CalculatorHelper.CALCULATOR_TYPES.sb101 ||
                eCalculatorType == SB1CalculatorHelper.CALCULATOR_TYPES.sb102)
            {
                e.HasCalculations = RunSB1Calculation(eCalculatorType,
                                                      statElement, linkedViewElement);
            }
            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);
                }
            }
        }