public void AddQueueStep(string description, OnStepUpdateEvent updateEvent)
        {
            var step = new DummyStep {
                Name = description
            };

            step.OnStepUpdate += updateEvent;

            _steps.Enqueue(step);
        }
Exemplo n.º 2
0
        private static IWorkplan GenerateWorkplan(int transCount)
        {
            var workplan = new WorkplanDummy();

            // Prepare connector variables
            var initial = Workflow.CreateConnector("Start", NodeClassification.Start);
            var left    = Workflow.CreateConnector("Left0", NodeClassification.Intermediate);
            var right   = Workflow.CreateConnector("Right0", NodeClassification.Intermediate);
            var final   = Workflow.CreateConnector("Final", NodeClassification.End);

            workplan.Add(initial, left, right, final);

            // Prepare step variable
            var step = new DummyStep(2, "Split");

            step.Inputs[0]  = initial;
            step.Outputs[0] = left;
            step.Outputs[1] = right;
            workplan.Add(step);

            // Create big maze
            DummyStep stepLeft = null, stepRight = null;

            for (int i = 0; i < transCount - 2; i++)
            {
                stepLeft            = new DummyStep(2, string.Format("Step{0}Left", i));
                stepLeft.Inputs[0]  = left;
                stepRight           = new DummyStep(2, string.Format("Step{0}Right", i));
                stepRight.Inputs[0] = right;
                workplan.Add(stepLeft, stepRight);

                left  = Workflow.CreateConnector(string.Format("Left{0}", i + 1), NodeClassification.Intermediate);
                right = Workflow.CreateConnector(string.Format("Right{0}", i + 1), NodeClassification.Intermediate);
                workplan.Add(left, right);

                stepLeft.Outputs[0] = stepRight.Outputs[1] = left;
                stepLeft.Outputs[1] = stepRight.Outputs[0] = right;
            }

            // Final join
            stepLeft.Outputs[1] = stepRight.Outputs[0] = left;
            var join = new DummyStep(1, "Complete");

            join.Inputs[0] = left;
            workplan.Add(join);
            join.Outputs[0] = final;
            return(workplan);
        }