public If(InArgument<bool> condition) : this()
 {
     if (condition == null)
     {
         throw FxTrace.Exception.ArgumentNull("condition");
     }
     this.Condition = condition;
 }
 /// <summary>
 /// Initializes a new instance of the LogBuildMessage class
 /// </summary>
 public LogBuildMessage()
 {
     this.importance = new InArgument<BuildMessageImportance>(new VisualBasicValue<BuildMessageImportance>
     {
         ExpressionText = "Microsoft.TeamFoundation.Build.Client.BuildMessageImportance.Normal"
     });
 }
 public MethodExecutor(Activity invokingActivity, Type targetType, InArgument targetObject, Collection<Argument> parameters, RuntimeArgument returnObject)
 {
     this.invokingActivity = invokingActivity;
     this.targetType = targetType;
     this.targetObject = targetObject;
     this.parameters = parameters;
     this.returnObject = returnObject;
 }
        public SubscribeFileChanges(InArgument<FileChangeSubscriptionHandle> subscriptionHandle,
			InArgument<string> folder, InArgument<string> pattern, bool subfolders)
            : this()
        {
            this.SubscriptionHandle = subscriptionHandle;
            this.WatchFolder = folder;
            this.WatchPattern = pattern;
            this.WatchSubfolders = subfolders;
        }
Exemplo n.º 5
0
 /// <summary>
 /// Converts a csv In-Argument to list of string
 /// </summary>
 /// <param name="context">Context</param>
 /// <param name="inArgument">In-Argument with csv-string</param>
 /// <returns>list of string</returns>
 internal static List<string> getList(CodeActivityContext context, InArgument<string> inArgument)
 {
     List<string> returnList = new List<string>();
     if (convertCSVtoListofString(context.GetValue(inArgument)).Count() > 0)
     {
         foreach (string i in convertCSVtoListofString(context.GetValue(inArgument)))
         {
             returnList.Add(i);
         }
     }
     return returnList;
 }
 public static InArgument CreateReference(InArgument argumentToReference, string referencedArgumentName)
 {
     if (argumentToReference == null)
     {
         throw FxTrace.Exception.ArgumentNull("argumentToReference");
     }
     if (string.IsNullOrEmpty(referencedArgumentName))
     {
         throw FxTrace.Exception.ArgumentNullOrEmpty("referencedArgumentName");
     }
     return (InArgument) ActivityUtilities.CreateReferenceArgument(argumentToReference.ArgumentType, ArgumentDirection.In, referencedArgumentName);
 }
 public SyncMethodExecutor(MethodInfo syncMethod, Activity invokingActivity, Type targetType, InArgument targetObject, Collection<Argument> parameters, RuntimeArgument returnObject) : base(invokingActivity, targetType, targetObject, parameters, returnObject)
 {
     this.syncMethod = syncMethod;
 }
 public AsyncPatternMethodExecutor(MethodInfo beginMethod, MethodInfo endMethod, Activity invokingActivity, Type targetType, InArgument targetObject, Collection<Argument> parameters, RuntimeArgument returnObject) : base(invokingActivity, targetType, targetObject, parameters, returnObject)
 {
     this.beginMethod = beginMethod;
     this.endMethod = endMethod;
 }
 public UnsubscribeFileChanges(InArgument<FileChangeSubscriptionHandle> subscriptionHandle)
     : this()
 {
     this.SubscriptionHandle = subscriptionHandle;
 }
        static SendReply CreateSendReply(ModelItem target, object context)
        {
            SendReply reply = null;
            ModelItem receive = (ModelItem)context;
            if (null != receive)
            {
                Receive receiveInstance = (Receive)receive.GetCurrentValue();
                string name = null;
                //if no correlation is set - create one
                if (null == receiveInstance.CorrelatesWith)
                {
                    Variable handleVariable = null;
                    //first, look for nearest variable scope 
                    ModelItemCollection variableScope = VariableHelper.FindRootVariableScope(receive).GetVariableCollection();
                    if (null != variableScope)
                    {
                        ModelItemCollection correlations = receive.Properties["CorrelationInitializers"].Collection;
                        bool hasRequestReplyHandle = false;
                        foreach (ModelItem item in correlations)
                        {
                            if (item.ItemType.IsAssignableFrom(typeof(RequestReplyCorrelationInitializer)))
                            {
                                hasRequestReplyHandle = true;
                                break;
                            }
                        }

                        if (!hasRequestReplyHandle)
                        {
                            //create unique variable name
                            name = variableScope.CreateUniqueVariableName("__handle", 1);
                            //create variable
                            handleVariable = Variable.Create(name, typeof(CorrelationHandle), VariableModifiers.None);
                            //add it to the scope
                            variableScope.Add(handleVariable);
                            //setup correlation
                            ImportDesigner.AddImport(CorrelationHandleTypeNamespace, receive.GetEditingContext());
                            VariableValue<CorrelationHandle> expression = new VariableValue<CorrelationHandle> { Variable = handleVariable };
                            InArgument<CorrelationHandle> handle = new InArgument<CorrelationHandle>(expression);
                            correlations.Add(new RequestReplyCorrelationInitializer { CorrelationHandle = handle });
                        }
                    }
                }

                reply = new SendReply()
                {
                    DisplayName = string.Format(CultureInfo.CurrentUICulture, "SendReplyTo{0}", receive.Properties["DisplayName"].ComputedValue),
                    Request = (Receive)receive.GetCurrentValue(),
                };
            }
            else
            {
                MessageBox.Show(
                    (string)StringResourceDictionary.Instance["receiveActivityCreateReplyErrorLabel"] ?? "Source 'Reply' element not found!",
                    (string)StringResourceDictionary.Instance["MessagingActivityTitle"] ?? "Send",
                    MessageBoxButton.OK, MessageBoxImage.Error);
            }
            return reply;
        }
 public SendMessageContent(InArgument message, Type declaredMessageType)
     : this(message)
 {
     this.DeclaredMessageType = declaredMessageType;
 }
            protected override void CacheMetadata(CodeActivityMetadata metadata)
            {
                RuntimeArgument instanceArgument = new RuntimeArgument("Instance", typeof(VolatileReceiveMessageInstance), ArgumentDirection.In);
                if (this.Instance == null)
                {
                    this.Instance = new InArgument<VolatileReceiveMessageInstance>();
                }
                metadata.Bind(this.Instance, instanceArgument);

                metadata.SetArgumentsCollection(
                    new Collection<RuntimeArgument>
                {
                    instanceArgument
                });
            }
Exemplo n.º 13
0
 public static SendMessageContent Create(InArgument message, Type declaredMessageType)
 {
     return new SendMessageContent(message) { DeclaredMessageType = declaredMessageType };
 }
Exemplo n.º 14
0
 public static SendMessageContent Create(InArgument message)
 {
     return new SendMessageContent(message);
 }
Exemplo n.º 15
0
		public static InArgument CreateReference (InArgument argumentToReference, string referencedArgumentName)
		{
			throw new NotImplementedException ();
		}
Exemplo n.º 16
0
        public static void CacheMetadataHelper(
            ActivityMetadata metadata, InArgument<IEnumerable> input, OutArgument<Collection<ErrorRecord>> errors, string commandText, string typeName,
            string displayName, IDictionary<string, Argument> variables, IDictionary<string, InArgument> parameters,
            IDictionary<string, Argument> childVariables, IDictionary<string, InArgument> childParameters)
        {
            childVariables.Clear();
            childParameters.Clear();
            RuntimeArgument inputArgument = new RuntimeArgument("Input", typeof(IEnumerable), ArgumentDirection.In);
            metadata.Bind(input, inputArgument);
            metadata.AddArgument(inputArgument);

            RuntimeArgument errorArgument = new RuntimeArgument("Errors", typeof(Collection<ErrorRecord>), ArgumentDirection.Out);
            metadata.Bind(errors, errorArgument);
            metadata.AddArgument(errorArgument);

            if (commandText == null || string.IsNullOrEmpty(commandText.Trim()))
            {
                metadata.AddValidationError(string.Format(ErrorMessages.PowerShellRequiresCommand, displayName));
            }

            foreach (KeyValuePair<string, Argument> variable in variables)
            {
                string name = variable.Key;
                Argument argument = variable.Value;
                RuntimeArgument ra = new RuntimeArgument(name, argument.ArgumentType, argument.Direction, true);
                metadata.Bind(argument, ra);
                metadata.AddArgument(ra);

                Argument childArgument = Argument.Create(argument.ArgumentType, argument.Direction);
                childVariables.Add(name, Argument.CreateReference(argument, name));
            }

            foreach (KeyValuePair<string, InArgument> parameter in parameters)
            {
                string name = parameter.Key;
                InArgument argument = parameter.Value;
                RuntimeArgument ra;
                if (argument.ArgumentType == typeof(bool))
                {
                    ra = new RuntimeArgument(name, argument.ArgumentType, argument.Direction, false);
                }
                else
                {
                    ra = new RuntimeArgument(name, argument.ArgumentType, argument.Direction, true);
                }
                metadata.Bind(argument, ra);
                metadata.AddArgument(ra);

                Argument childArgument = Argument.Create(argument.ArgumentType, argument.Direction);
                childParameters.Add(name, Argument.CreateReference(argument, name) as InArgument);
            }
        }
 public SendMessageContent(InArgument message)
     : this()
 {
     this.Message = message;
 }
Exemplo n.º 18
0
 /// <summary>
 /// Gets the string passed as parameter if the argument has the value
 /// true
 /// </summary>
 /// <param name="argument">the argument to check</param>
 /// <param name="context">activity context</param>
 /// <param name="value">the value to be returned if the variable holds true </param>
 /// <returns>The value if true an empty string otherwise</returns>
 private static string GetStringIfTrue(InArgument<bool> argument, ActivityContext context, string value)
 {
     return GetStringIfTrue(argument.Get(context), value);
 }
Exemplo n.º 19
0
Arquivo: If.cs Projeto: nickchal/pash
		public If (InArgument<bool> condition)
		{
			throw new NotImplementedException ();
		}
Exemplo n.º 20
0
        static Activity CreateAverageCalculationWorkflow()
        {
            // Variables
            var iterationVariable = new DelegateInArgument<int>() { Name = "iterationVariable" };
            var accumulator = new Variable<int>() { Default = 0, Name = "accumulator" };

            // Define the Input and Output arguments that the DynamicActivity binds to
            var numbers = new InArgument<List<int>>();
            var average = new OutArgument<double>();

            var result = new Variable<double>() { Name = "result" };

            return new DynamicActivity()
            {
                DisplayName = "Find average",
                Properties =
                {
                    // Input argument
                    new DynamicActivityProperty
                    {
                        Name = "Numbers",
                        Type = typeof(InArgument<List<int>>),
                        Value = numbers
                    },
                    // Output argument
                    new DynamicActivityProperty
                    {
                        Name = "Average",
                        Type = typeof(OutArgument<double>),
                        Value = average
                    }
                },
                Implementation = () =>
                    new Sequence
                    {
                        Variables = { result, accumulator },
                        Activities =
                        {
                            new ForEach<int>
                            {
                                Values =  new ArgumentValue<IEnumerable<int>> { ArgumentName = "Numbers" },
                                Body = new ActivityAction<int>
                                {
                                    Argument = iterationVariable,
                                    Handler = new Assign<int>
                                    {
                                        To = accumulator,
                                        Value = new InArgument<int>(env => iterationVariable.Get(env) +  accumulator.Get(env))
                                    }
                                }
                            },

                            // Calculate the average and assign to the output argument.
                            new Assign<double>
                            {
                                To = new ArgumentReference<double> { ArgumentName = "Average" },
                                Value = new InArgument<double>(env => accumulator.Get(env) / numbers.Get(env).Count<int>())
                            },
                        }
                    }
            };
        }