Exemplo n.º 1
0
        protected override void Execute(CodeActivityContext context)
        {
            var firstNumber  = FirstNumber.Get(context);
            var secondNumber = SecondNumber.Get(context);
            var result       = System.Math.Pow(firstNumber + secondNumber, 2);

            ResultNumber.Set(context, result);
        }
Exemplo n.º 2
0
        protected override void Execute(CodeActivityContext context)
        {
            double firstNumber  = FirstNumber.Get(context);
            double secondNumber = SecondNumber.Get(context);

            HelperMethod method = new HelperMethod();
            var          result = method.sumTwoNumber(firstNumber, secondNumber);

            ResultNumber.Set(context, result);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Runs the main logic of the activity. Has access to the context,
        /// which holds the values of properties for this activity and those from the parent scope.
        /// </summary>
        /// <param name="context"></param>
        /// <param name="cancellationToken"></param>
        /// <returns></returns>
        protected override async Task <Action <AsyncCodeActivityContext> > ExecuteAsync(AsyncCodeActivityContext context, CancellationToken cancellationToken)
        {
            var property = context.DataContext.GetProperties()[ParentScope.ApplicationTag];
            var app      = property.GetValue(context.DataContext) as Application;

            var firstValue  = FirstNumber.Get(context);
            var secondValue = SecondNumber.Get(context);

            var sum = app.Sum(firstValue, secondValue);

            return(ctx =>
            {
                Sum.Set(ctx, sum);
            });
        }