Ejemplo n.º 1
0
 public static void AddCacheArgument(System.Activities.NativeActivityMetadata metadata, string name, System.Activities.Argument argument)
 {
     try
     {
         if (argument == null)
         {
             return;
         }
         Type ttype = argument.GetType().GetGenericArguments()[0];
         System.Activities.ArgumentDirection direction = System.Activities.ArgumentDirection.In;
         if (argument is System.Activities.InArgument)
         {
             direction = System.Activities.ArgumentDirection.In;
         }
         if (argument is System.Activities.InOutArgument)
         {
             direction = System.Activities.ArgumentDirection.InOut;
         }
         if (argument is System.Activities.OutArgument)
         {
             direction = System.Activities.ArgumentDirection.Out;
         }
         var ra = new System.Activities.RuntimeArgument(name, ttype, direction);
         metadata.Bind(argument, ra);
         metadata.AddArgument(ra);
     }
     catch (Exception)
     {
         throw;
     }
 }
Ejemplo n.º 2
0
        internal static void TryBind(Argument binding, System.Activities.RuntimeArgument argument, Activity violationOwner)
        {
            if (argument == null)
            {
                throw FxTrace.Exception.ArgumentNull("argument");
            }
            bool flag = true;

            if (binding != null)
            {
                if (binding.Direction != argument.Direction)
                {
                    violationOwner.AddTempValidationError(new ValidationError(System.Activities.SR.ArgumentDirectionMismatch(argument.Name, argument.Direction, binding.Direction)));
                    flag = false;
                }
                if (binding.ArgumentType != argument.Type)
                {
                    violationOwner.AddTempValidationError(new ValidationError(System.Activities.SR.ArgumentTypeMismatch(argument.Name, argument.Type, binding.ArgumentType)));
                    flag = false;
                }
            }
            if (flag)
            {
                Bind(binding, argument);
            }
        }
Ejemplo n.º 3
0
 internal static void Bind(Argument binding, System.Activities.RuntimeArgument argument)
 {
     if (binding != null)
     {
         binding.RuntimeArgument = argument;
     }
     argument.BoundArgument = binding;
 }