Exemplo n.º 1
0
        public override ValidationErrorCollection Validate(ValidationManager manager, object obj)
        {
            ValidationErrorCollection __errors         = base.Validate(manager, obj);
            IfElseActivityCustom      __ifElseActivity = obj as IfElseActivityCustom;

            if (__ifElseActivity == null)
            {
                throw new ArgumentException("obj");
            }
            if (__ifElseActivity.EnabledActivities.Count < 1)
            {
                // TODO : Get the exception message from the System.Workflow.Activities.StringResources.resources resource file.
                __errors.Add(new ValidationError("A IfElseActivity activity must have at least one child of type IfElseBranch.", 1292));
            }
            foreach (Activity activity in __ifElseActivity.EnabledActivities)
            {
                if (!(activity is IfElseBranchActivityCustom))
                {
                    // TODO : Get the exception message from the System.Workflow.Activities.StringResources.resources resource file.
                    __errors.Add(new ValidationError("All children must be of type IfElseBranch.", 1293));
                    return(__errors);
                }
            }
            return(__errors);
        }
Exemplo n.º 2
0
        protected override IComponent[] CreateComponentsCore(IDesignerHost designerHost)
        {
            CompositeActivity __activity = new IfElseActivityCustom();

            __activity.Activities.Add(new IfElseBranchActivityCustom());
            __activity.Activities.Add(new IfElseBranchActivityCustom());
            return(new IComponent[1] {
                __activity
            });
        }
Exemplo n.º 3
0
        public override ValidationErrorCollection Validate(ValidationManager manager, object obj)
        {
            ValidationErrorCollection  __errors = base.Validate(manager, obj);
            IfElseBranchActivityCustom __branch = (IfElseBranchActivityCustom)obj;
            IfElseActivityCustom       __parent = __branch.Parent as IfElseActivityCustom;

            if (__parent == null)
            {
                // TODO : Get the exception message from the System.Workflow.Activities.StringResources.resources resource file.
                __errors.Add(new ValidationError("Parent of CustomIfElseBranch must be an IfElse", 0x50e));
            }
            int __index = __parent.Activities.IndexOf(__branch);

            // The last branch can have a condition which is null.
            if (((__parent.Activities.Count <= 1) || (__index < (__parent.Activities.Count - 1))) && (__branch.Condition == null))
            {
                __errors.Add(ValidationError.GetNotSetValidationError("Condition"));
            }
            return(__errors);
        }