public void Execute(frmProgress fp)
        {
            this.fp = fp;
            ExecutionBlock currentNode = root.NormalChild;
            object         lastObject  = null;

            while (currentNode != null)
            {
                AddText("Executing block " + currentNode.DataBinding.Name + "\r\n");

                ExecutionUnitOutput output = currentNode.Execute(lastObject);
                currentNode = currentNode.NormalChild;
                if (output == null)
                {
                    lastObject = null;
                }
                else
                {
                    lastObject = output.ObjectOutput;
                    if (currentNode is DecisionUnit)
                    {
                        if (!output.DecisionOutput)
                        {
                            currentNode = currentNode.NegationChild;
                        }
                    }
                }
            }
            AddText("Execution done!");
        }
        private ExecutionBlock BuildExecutionTree(DesignerItem root, Connection[] connections)
        {
            foreach (ExecutionBlock ebtmp in denyList)
            {
                if (ebtmp.MyDesignerItem == root)
                {
                    return(ebtmp);
                }
            }
            ExecutionBlock eb = null;
            string         s  = XamlWriter.Save(root.Content);

            if ((s.Contains("ToolTip=\"Start\"")) || (s.Contains("ToolTip=\"Terminator\"")) || (s.Contains("ToolTip=\"Process\"")))
            {
                eb = new ProcessingUnit(root.DataBinding);
                eb.MyDesignerItem = root;
                denyList.Add(eb);
                //cautam urmatorul element dupa conector si generam lista
                foreach (Connection c in connections)
                {
                    if (c.Source.ParentDesignerItem == root)
                    {
                        eb.NormalChild = BuildExecutionTree(c.Sink.ParentDesignerItem, connections);
                        break;
                    }
                }
            }
            else
            {
                //avem nod decisional
                eb = new DecisionUnit(root.DataBinding);
                eb.MyDesignerItem = root;
                denyList.Add(eb);
                //aflam conexiunea pentru copilul normal si negat
                int cnt = 0;
                foreach (Connection c in connections)
                {
                    if (cnt == 2)
                    {
                        break;
                    }
                    if (c.Source.ParentDesignerItem == root)
                    {
                        if (c.Source.Name == "Right")
                        {
                            cnt++;
                            //copilul normal
                            eb.NormalChild = BuildExecutionTree(c.Sink.ParentDesignerItem, connections);
                        }
                        else
                        {
                            //copilul negat
                            cnt++;
                            eb.NegationChild = BuildExecutionTree(c.Sink.ParentDesignerItem, connections);
                        }
                    }
                }
            }

            return(eb);
        }
 public Orchestrator(DesignerItem root, Connection[] connections)
 {
     //presupunem ca am primit nodul de start si contruim diagram pornind din el
     denyList.Clear();
     this.root = BuildExecutionTree(root, connections);
 }