Пример #1
0
        private void HandleNextNode()
        {
            if (childQueue.Count == 0)
            {
                Done();
                return;
            }

            FluentNode firstNode = childQueue.Dequeue();

            firstNode.SetDoneCallback(SequentialChildCompleted);
            firstNode.Execute();
        }
Пример #2
0
        private void HandleNextNode()
        {
            // Check if all the nodes have been handled
            if (childQueue.Count == 0)
            {
                // Start the options presenter
                optionsPresenter.SetupOptions(this);
                return;
            }


            FluentNode firstNode = childQueue.Dequeue();

            firstNode.SetDoneCallback(SequentialChildCompleted);
            firstNode.Execute();
        }
Пример #3
0
        private void HandleNextNode()
        {
            // Check if we handled all the children
            if (childQueue.Count == 0)
            {
                // Lets see if we should restart the while
                if (!test())
                {
                    Done();
                    return;
                }

                // Add all the children again
                Children.ForEach(n => childQueue.Enqueue(n));
            }

            FluentNode firstNode = childQueue.Dequeue();

            firstNode.SetDoneCallback(ChildCompleted);
            firstNode.Execute();
        }
Пример #4
0
        private void HandleNextNode()
        {
            if (childrenLeftToExecute.Count == 0)
            {
                // Ugh, think about cleanup
                if (GoesBack && (Parent is OptionsNode) && (Parent.Parent is OptionNode) && (Parent.Parent.Parent is OptionsNode))
                {
                    Parent.Parent.Parent.Execute();
                }
                else
                {
                    HasBeenChosen = true;
                    Done();
                }

                return;
            }

            FluentNode firstNode = childrenLeftToExecute.Dequeue();

            firstNode.SetDoneCallback(OptionChildCompleted);
            firstNode.Execute();
        }
Пример #5
0
        /// <summary>
        /// Call this to start the FluentScript
        /// </summary>
        public virtual void Run()
        {
            //
            OnStart();

            // Create the fluent script
            FluentNode firstNode = SequentialNode(Create());

            // Do a couple of things to the tree before execution starts
            firstNode.Visit((n) =>
            {
                // Tell all the children who the parent is
                n.Children.ForEach(c => c.Parent = n);

                // Run their before execute methods
                n.BeforeExecute();
            });

            //
            firstNode.SetDoneCallback(RootDone);

            //
            firstNode.Execute();
        }