コード例 #1
0
        public void AddArgument(RuntimeArgument argument)
        {
            ThrowIfDisposed();

            if (argument != null)
            {
                _activity.AddArgument(argument, _createEmptyBindings);
            }
        }
        private void AddGeneratedArgument(Type argumentType, ArgumentDirection direction, ActivityWithResult expression)
        {
            Argument argument = ActivityUtilities.CreateArgument(argumentType, direction);

            argument.Expression = expression;
            RuntimeArgument runtimeArgument = this.metadata.CurrentActivity.AddTempAutoGeneratedArgument(argumentType, direction);

            Argument.TryBind(argument, runtimeArgument, this.metadata.CurrentActivity);
        }
コード例 #3
0
        // Soft-Link: This method is referenced through reflection by
        // ExpressionUtilities.TryRewriteLambdaExpression.  Update that
        // file if the signature changes.
        //[SuppressMessage(FxCop.Category.Design, FxCop.Rule.ConsiderPassingBaseTypesAsParameters,
        //    Justification = "We explicitly provide a RuntimeArgument overload to avoid requiring the object type parameter.")]
        public object GetValue(RuntimeArgument runtimeArgument)
        {
            ThrowIfDisposed();

            if (runtimeArgument == null)
            {
                throw FxTrace.Exception.ArgumentNull(nameof(runtimeArgument));
            }

            return(GetValueCore <object>(runtimeArgument));
        }
コード例 #4
0
        // Soft-Link: This method is referenced through reflection by
        // ExpressionUtilities.TryRewriteLambdaExpression.  Update that
        // file if the signature changes.
        //[SuppressMessage(FxCop.Category.Design, FxCop.Rule.ConsiderPassingBaseTypesAsParameters,
        //Justification = "We explicitly provide a RuntimeArgument overload to avoid requiring the object type parameter.")]
        public object GetValue(RuntimeArgument runtimeArgument)
        {
            ThrowIfDisposed();

            if (runtimeArgument == null)
            {
                throw CoreWf.Internals.FxTrace.Exception.ArgumentNull("runtimeArgument");
            }

            return(GetValueCore <object>(runtimeArgument));
        }
コード例 #5
0
        // for ArgumentValueSerializer
        //internal bool CanConvertToString(IValueSerializerContext context)
        //{
        //    if (this.WasDesignTimeNull)
        //    {
        //        return true;
        //    }
        //    else
        //    {
        //        if (this.EvaluationOrder == Argument.UnspecifiedEvaluationOrder)
        //        {
        //            return ActivityWithResultValueSerializer.CanConvertToStringWrapper(this.Expression, context);
        //        }
        //        else
        //        {
        //            return false;
        //        }
        //    }
        //}

        //internal string ConvertToString(IValueSerializerContext context)
        //{
        //    if (this.WasDesignTimeNull)
        //    {
        //        // this argument instance was artificially created by the runtime
        //        // to Xaml, this should appear as {x:Null}
        //        return null;
        //    }

        //    return ActivityWithResultValueSerializer.ConvertToStringWrapper(this.Expression, context);
        //}

        internal static void Bind(Argument binding, RuntimeArgument argument)
        {
            if (binding != null)
            {
                Fx.Assert(binding.Direction == argument.Direction, "The directions must match.");
                Fx.Assert(binding.ArgumentType == argument.Type, "The types must match.");

                binding.RuntimeArgument = argument;
            }

            argument.BoundArgument = binding;
        }
コード例 #6
0
        public void Bind(Argument binding, RuntimeArgument argument)
        {
            ThrowIfDisposed();

            Argument.TryBind(binding, argument, _activity);
        }
コード例 #7
0
 internal Location GetIgnorableResultLocation(RuntimeArgument resultArgument)
 {
     return(this.executor.GetIgnorableResultLocation(resultArgument));
 }
コード例 #8
0
        public static IEnumerable <Activity> GetActivities(Activity activity)
        {
            if (activity == null)
            {
                throw CoreWf.Internals.FxTrace.Exception.ArgumentNull("activity");
            }

            if (!activity.IsMetadataCached)
            {
                IList <ValidationError> validationErrors = null;

                ActivityUtilities.CacheRootMetadata(activity, new ActivityLocationReferenceEnvironment(), ProcessActivityTreeOptions.FullCachingOptions, null, ref validationErrors);

                ActivityValidationServices.ThrowIfViolationsExist(validationErrors);
            }

            int i = 0;

            for (; i < activity.RuntimeArguments.Count; i++)
            {
                RuntimeArgument argument = activity.RuntimeArguments[i];

                if (argument.BoundArgument != null && argument.BoundArgument.Expression != null)
                {
                    yield return(argument.BoundArgument.Expression);
                }
            }

            for (i = 0; i < activity.RuntimeVariables.Count; i++)
            {
                Variable variable = activity.RuntimeVariables[i];

                if (variable.Default != null)
                {
                    yield return(variable.Default);
                }
            }

            for (i = 0; i < activity.ImplementationVariables.Count; i++)
            {
                Variable variable = activity.ImplementationVariables[i];

                if (variable.Default != null)
                {
                    yield return(variable.Default);
                }
            }

            for (i = 0; i < activity.Children.Count; i++)
            {
                yield return(activity.Children[i]);
            }

            for (i = 0; i < activity.ImportedChildren.Count; i++)
            {
                yield return(activity.ImportedChildren[i]);
            }

            for (i = 0; i < activity.ImplementationChildren.Count; i++)
            {
                yield return(activity.ImplementationChildren[i]);
            }

            for (i = 0; i < activity.Delegates.Count; i++)
            {
                ActivityDelegate activityDelegate = activity.Delegates[i];

                if (activityDelegate.Handler != null)
                {
                    yield return(activityDelegate.Handler);
                }
            }

            for (i = 0; i < activity.ImportedDelegates.Count; i++)
            {
                ActivityDelegate activityDelegate = activity.ImportedDelegates[i];

                if (activityDelegate.Handler != null)
                {
                    yield return(activityDelegate.Handler);
                }
            }

            for (i = 0; i < activity.ImplementationDelegates.Count; i++)
            {
                ActivityDelegate activityDelegate = activity.ImplementationDelegates[i];

                if (activityDelegate.Handler != null)
                {
                    yield return(activityDelegate.Handler);
                }
            }
        }