public override Guid Execute(ActivityContext context) { var activity = Activity.CreateInstance(this.ActivityId) as EndNodeActivity; activity.Execute(context); return(Guid.Empty); }
public override Guid Execute(IEnumerable <VariableNode> variableNodes) { var activity = Activity.CreateInstance(this.ActivityId) as EndNodeActivity; activity.Execute(new ActivityContext(variableNodes)); return(Guid.Empty); }
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); }
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); }
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); } }
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); } }
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); } }
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); }
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); }