public HttpRequestIfElseActivityModel()
        {
            DisplayName = "Decision";
            eventAggregator = ServiceLocator.Current.GetInstance<IEventAggregator>();
            ConditionTrueActivity = new ActivityAction();
            ConditionFalseActivity = new ActivityAction();
            ResponseSections = new ObservableCollection<string>();
            Operators = new ObservableCollection<string>();

            ResponseSections.Add("Status Code");
            ResponseSections.Add("Headers");
            ResponseSections.Add("Body");

            Operators.Add("Equals");
            Operators.Add("Does not equal");
            Operators.Add("Includes");
            Operators.Add("Does not include");
        }
 private static Constraint ConfirmWithNoTarget()
 {
     DelegateInArgument<Confirm> element = new DelegateInArgument<Confirm> {
         Name = "element"
     };
     DelegateInArgument<ValidationContext> argument = new DelegateInArgument<ValidationContext> {
         Name = "validationContext"
     };
     Variable<bool> assertFlag = new Variable<bool> {
         Name = "assertFlag"
     };
     Variable<IEnumerable<Activity>> elements = new Variable<IEnumerable<Activity>> {
         Name = "elements"
     };
     Variable<int> index = new Variable<int> {
         Name = "index"
     };
     Constraint<Confirm> constraint = new Constraint<Confirm>();
     ActivityAction<Confirm, ValidationContext> action = new ActivityAction<Confirm, ValidationContext> {
         Argument1 = element,
         Argument2 = argument
     };
     Sequence sequence = new Sequence {
         Variables = { assertFlag, elements, index }
     };
     If item = new If {
         Condition = new InArgument<bool>(env => element.Get(env).Target != null)
     };
     Assign<bool> assign = new Assign<bool> {
         To = assertFlag,
         Value = 1
     };
     item.Then = assign;
     Sequence sequence2 = new Sequence();
     Assign<IEnumerable<Activity>> assign2 = new Assign<IEnumerable<Activity>> {
         To = elements
     };
     GetParentChain chain = new GetParentChain {
         ValidationContext = argument
     };
     assign2.Value = chain;
     sequence2.Activities.Add(assign2);
     While @while = new While(env => !assertFlag.Get(env) && (index.Get(env) < elements.Get(env).Count<Activity>()));
     Sequence sequence3 = new Sequence();
     If if2 = new If(env => elements.Get(env).ElementAt<Activity>(index.Get(env)).GetType() == typeof(CompensationParticipant));
     Assign<bool> assign3 = new Assign<bool> {
         To = assertFlag,
         Value = 1
     };
     if2.Then = assign3;
     sequence3.Activities.Add(if2);
     Assign<int> assign4 = new Assign<int> {
         To = index,
         Value = new InArgument<int>(env => index.Get(env) + 1)
     };
     sequence3.Activities.Add(assign4);
     @while.Body = sequence3;
     sequence2.Activities.Add(@while);
     item.Else = sequence2;
     sequence.Activities.Add(item);
     AssertValidation validation = new AssertValidation {
         Assertion = new InArgument<bool>(assertFlag),
         Message = new InArgument<string>(System.Activities.SR.ConfirmWithNoTargetConstraint)
     };
     sequence.Activities.Add(validation);
     action.Handler = sequence;
     constraint.Body = action;
     return constraint;
 }
 public ConditionalOperationTaskWaiter()
 {
     responseResultWaiter = TaskWaiter.CreateActivityDelegate();
 }
예제 #4
0
		private Constraint ValidateActivitiesConstraint(string runtimeAssembly, PSWorkflowValidationResults validationResults)
		{
			var activityToValidate = new DelegateInArgument<Activity>();
			DelegateInArgument<ValidationContext> delegateInArgument1 = new DelegateInArgument<ValidationContext>();
			Constraint<Activity> constraint = new Constraint<Activity>();
			ActivityAction<Activity, ValidationContext> activityAction = new ActivityAction<Activity, ValidationContext>();
			activityAction.Argument1 = activityToValidate;
			activityAction.Argument2 = delegateInArgument1;
			AssertValidation assertValidation = new AssertValidation();
			assertValidation.IsWarning = false;
			ParameterExpression parameterExpression = Expression.Parameter(typeof(ActivityContext), "env");
			Expression[] expressionArray = new Expression[3];
			Expression[] expressionArray1 = new Expression[1];
			expressionArray1[0] = parameterExpression;
			expressionArray[0] = Expression.Call(Expression.Field(Expression.Constant(this), FieldInfo.GetFieldFromHandle(activityToValidate)), (MethodInfo)MethodBase.GetMethodFromHandle(Get, DelegateInArgument<Activity>), expressionArray1);
			expressionArray[1] = Expression.Field(Expression.Constant(this), FieldInfo.GetFieldFromHandle(runtimeAssembly));
			expressionArray[2] = Expression.Field(Expression.Constant(this), FieldInfo.GetFieldFromHandle(validationResults));
			ParameterExpression[] parameterExpressionArray = new ParameterExpression[1];
			parameterExpressionArray[0] = parameterExpression;
			assertValidation.Assertion = new InArgument<bool>(Expression.Lambda<Func<ActivityContext, bool>>(Expression.Call(Expression.Constant(this, typeof(PSWorkflowValidator)), (MethodInfo)MethodBase.GetMethodFromHandle(ValidateActivity), expressionArray), parameterExpressionArray));
			ParameterExpression parameterExpression1 = Expression.Parameter(typeof(ActivityContext), "env");
			Expression[] expressionArray2 = new Expression[3];
			expressionArray2[0] = Expression.Property(null, typeof(CultureInfo).GetProperty ("CurrentCulture", BindingFlags.Static)); //TODO: REIVEW: (MethodInfo)MethodBase.GetMethodFromHandle(CultureInfo.get_CurrentCulture));
			expressionArray2[1] = Expression.Property(null, typeof(Resources).GetProperty ("InvalidActivity", BindingFlags.Static)); //TODO: REVIEW: (MethodInfo)MethodBase.GetMethodFromHandle(Resources.get_InvalidActivity));
			Expression[] expressionArray3 = new Expression[1];
			Expression[] expressionArray4 = new Expression[1];
			expressionArray4[0] = parameterExpression1;
			expressionArray3[0] = Expression.Property(Expression.Call(Expression.Call(Expression.Field(Expression.Constant(this), FieldInfo.GetFieldFromHandle(PSWorkflowValidator.PSWorkflowValidator.activityToValidate)), (MethodInfo)MethodBase.GetMethodFromHandle(Get, DelegateInArgument<Activity>), expressionArray4), (MethodInfo)MethodBase.GetMethodFromHandle(GetType), new Expression[0]), (MethodInfo)MethodBase.GetMethodFromHandle(get_FullName));
			expressionArray2[2] = Expression.NewArrayInit(typeof(object), expressionArray3);
			ParameterExpression[] parameterExpressionArray1 = new ParameterExpression[1];
			parameterExpressionArray1[0] = parameterExpression1;
			assertValidation.Message = new InArgument<string>(Expression.Lambda<Func<ActivityContext, string>>(Expression.Call(null, (MethodInfo)MethodBase.GetMethodFromHandle(string.Format), expressionArray2), parameterExpressionArray1));
			activityAction.Handler = assertValidation;
			constraint.Body = activityAction;
			return constraint;
		}
예제 #5
0
 public ActivityInstance ScheduleAction <T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16> (ActivityAction <T1, T2, T3, T4, T5, T6, T7, T8, T9, T10, T11, T12, T13, T14, T15, T16> activityAction, T1 argument1, T2 argument2, T3 argument3, T4 argument4, T5 argument5, T6 argument6, T7 argument7, T8 argument8, T9 argument9, T10 argument10, T11 argument11, T12 argument12, T13 argument13, T14 argument14, T15 argument15, T16 argument16, CompletionCallback onCompleted, FaultCallback onFaulted)
 {
     throw new NotImplementedException();
 }
예제 #6
0
 public ActivityInstance ScheduleAction <T1, T2, T3, T4, T5, T6, T7, T8> (ActivityAction <T1, T2, T3, T4, T5, T6, T7, T8> activityAction, T1 argument1, T2 argument2, T3 argument3, T4 argument4, T5 argument5, T6 argument6, T7 argument7, T8 argument8, CompletionCallback onCompleted, FaultCallback onFaulted)
 {
     throw new NotImplementedException();
 }
예제 #7
0
 public ActivityInstance ScheduleAction <T1, T2, T3, T4> (ActivityAction <T1, T2, T3, T4> activityAction, T1 argument1, T2 argument2, T3 argument3, T4 argument4, CompletionCallback onCompleted, FaultCallback onFaulted)
 {
     throw new NotImplementedException();
 }
예제 #8
0
 public ActivityInstance ScheduleAction <T> (ActivityAction <T> activityAction, T argument, CompletionCallback onCompleted, FaultCallback onFaulted)
 {
     throw new NotImplementedException();
 }