예제 #1
0
파일: EndNode.cs 프로젝트: wsun-clgx/Roro
        public override Guid Execute(ActivityContext context)
        {
            var activity = Activity.CreateInstance(this.ActivityId) as EndNodeActivity;

            activity.Execute(context);
            return(Guid.Empty);
        }
예제 #2
0
파일: EndNode.cs 프로젝트: wuyi165/Roro
        public override Guid Execute(IEnumerable <VariableNode> variableNodes)
        {
            var activity = Activity.CreateInstance(this.ActivityId) as EndNodeActivity;

            activity.Execute(new ActivityContext(variableNodes));
            return(Guid.Empty);
        }
예제 #3
0
        public override Guid Execute(IEnumerable <VariableNode> variables)
        {
            var processNodeActivity = Activity.CreateInstance(this.Activity.GetType().FullName) as ProcessNodeActivity;

            processNodeActivity.Inputs  = this.Inputs;
            processNodeActivity.Outputs = this.Outputs;
            processNodeActivity.Execute(new ActivityContext(variables));
            return(this.Ports.First().NextNodeId);
        }
예제 #4
0
        public override Guid Execute(ActivityContext context)
        {
            var activity = Activity.CreateInstance(this.ActivityId) as ProcessNodeActivity;

            activity.Inputs  = this.ActivityInputs;
            activity.Outputs = this.ActivityOutputs;
            activity.Execute(context);
            return(this.Ports.First().NextNodeId);
        }
예제 #5
0
        public override Guid Execute(IEnumerable <VariableNode> variables)
        {
            var decisionNodeActivity = Activity.CreateInstance(this.Activity.GetType().FullName) as DecisionNodeActivity;

            decisionNodeActivity.Inputs  = this.Inputs;
            decisionNodeActivity.Outputs = this.Outputs;
            if (decisionNodeActivity.Execute(new ActivityContext(variables)))
            {
                return(this.Ports.Where(x => x is TruePort).First().Id);
            }
            else
            {
                return(this.Ports.Where(x => x is FalsePort).First().Id);
            }
        }
예제 #6
0
        public override Guid Execute(IEnumerable <VariableNode> variables)
        {
            var activity = Activity.CreateInstance(this.ActivityId) as DecisionNodeActivity;

            activity.Inputs  = this.ActivityInputs;
            activity.Outputs = this.ActivityOutputs;
            if (activity.Execute(new ActivityContext(variables)))
            {
                return(this.Ports.Where(x => x is TruePort).First().NextNodeId);
            }
            else
            {
                return(this.Ports.Where(x => x is FalsePort).First().NextNodeId);
            }
        }
예제 #7
0
        public override Guid Execute(ActivityContext context)
        {
            var activity = Activity.CreateInstance(this.ActivityId) as DecisionNodeActivity;

            activity.Inputs  = this.ActivityInputs;
            activity.Outputs = this.ActivityOutputs;
            if (activity.Execute(context))
            {
                return(this.Ports.Where(x => x is TruePort).First().NextNodeId);
            }
            else
            {
                return(this.Ports.Where(x => x is FalsePort).First().NextNodeId);
            }
        }
예제 #8
0
파일: Page.cs 프로젝트: zergmk2/Roro
        private Node AddNode(string activityId, int x, int y)
        {
            if (this.State == PageState.Running)
            {
                MessageBox.Show("The robot is currently running.");
                return(null);
            }

            Node node;
            var  activity = Activity.CreateInstance(activityId);

            if (activity is StartNodeActivity)
            {
                node = new StartNode(activity)
                {
                    Name = "Start"
                };
            }
            else if (activity is EndNodeActivity)
            {
                node = new EndNode(activity)
                {
                    Name = "End"
                };
            }
            else if (activity is ProcessNodeActivity)
            {
                node = new ProcessNode(activity);
            }
            else if (activity is DecisionNodeActivity)
            {
                node = new DecisionNode(activity);
            }
            else if (activity is LoopStartNodeActivity)
            {
                node = new LoopStartNode(activity)
                {
                    Name = "Start Loop"
                };
                var loopStartNode = node as LoopStartNode;
                var loopEndNode   = this.AddNode(typeof(LoopEndNodeActivity).FullName, x, y + PageRenderOptions.GridSize * 10) as LoopEndNode;
                loopStartNode.LoopEndNodeId = loopEndNode.Id;
                loopEndNode.LoopStartNodeId = loopStartNode.Id;
            }
            else if (activity is LoopEndNodeActivity)
            {
                node = new LoopEndNode(activity)
                {
                    Name = "End Loop"
                };
            }
            else if (activity is VariableNodeActivity)
            {
                var variableIndex = 1;
                while (this.GetNodes <VariableNode>().Count(v => v.Name == "Variable " + variableIndex) > 0)
                {
                    variableIndex++;
                }
                node = new VariableNode(activity)
                {
                    Name = "Variable " + variableIndex
                };
            }
            else
            {
                throw new NotSupportedException();
            }
            var bounds = node.Bounds;

            bounds.X = x - bounds.Width / 2;
            bounds.Y = y - bounds.Height / 2;
            node.SetBounds(bounds);
            this.Nodes.Add(node);
            return(node);
        }
예제 #9
0
파일: Page.cs 프로젝트: mrkem598/Roro
        public Node AddNode(string activityFullName, int x, int y)
        {
            Node node;
            var  activity = Activity.CreateInstance(activityFullName);

            if (activity is StartNodeActivity)
            {
                node = new StartNode(this.StartNodeActivity)
                {
                    Name = "Start"
                };
            }
            else if (activity is EndNodeActivity)
            {
                node = new EndNode(this.EndNodeActivity)
                {
                    Name = "End"
                };
            }
            else if (activity is ProcessNodeActivity)
            {
                node = new ProcessNode(activity)
                {
                    Name = activityFullName.Split('.').Last().Humanize()
                };
            }
            else if (activity is DecisionNodeActivity)
            {
                node = new DecisionNode(activity)
                {
                    Name = activityFullName.Split('.').Last().Humanize()
                };
            }
            else if (activity is PreparationNodeActivity)
            {
                node = new PreparationNode(activity)
                {
                    Name = "Preparation"
                };
            }
            else if (activity is LoopStartNodeActivity)
            {
                node = new LoopStartNode(activity)
                {
                    Name = "Start Loop"
                };
                var loopStartNode = node as LoopStartNode;
                var loopEndNode   = this.AddNode(typeof(LoopEndNodeActivity).FullName, x, y + PageRenderOptions.GridSize * 10) as LoopEndNode;
                loopStartNode.LoopEndNodeId = loopEndNode.Id;
                loopEndNode.LoopStartNodeId = loopStartNode.Id;
            }
            else if (activity is LoopEndNodeActivity)
            {
                node = new LoopEndNode(activity)
                {
                    Name = "End Loop"
                };
            }
            else
            {
                throw new NotSupportedException();
            }
            var bounds = node.Bounds;

            bounds.Location = new Point(x, y);
            bounds.Offset(-bounds.Width / 2, -bounds.Height / 2);
            node.SetBounds(bounds);
            this.Nodes.Add(node);
            return(node);
        }