예제 #1
0
        public override IStepNode BuildGraph()
        {
            IStepNode root = base.BuildGraph();

            _node.ConnectBranch(_branch, root);
            return(root);
        }
예제 #2
0
        private void AddNode(IStepNode node, SimpleStepNode simpleNode)
        {
            if (_rootNode == null)
            {
                _rootNode = node;
            }
            else if (_lastSimpleNode != null)
            {
                _lastSimpleNode.AttachNode(node);

                // HAX: attach the node to the top-level decorator so that Previous works correctly
                node.AttachTo(_lastNode);
            }

            _lastNode       = node;
            _lastSimpleNode = simpleNode;
        }
예제 #3
0
        public bool Back()
        {
            if (_currentNode == null)
            {
                return(false);
            }

            IStepNode previousNode = _currentNode.Previous;

            if (previousNode == null)
            {
                return(false);
            }

            ViewNode(previousNode);
            return(true);
        }
예제 #4
0
        public void ViewNode(IStepNode node)
        {
            if (BeforeViewNode != null)
            {
                ViewNodeEventArgs args = new ViewNodeEventArgs(node, node.Previous != null, node.Next != null);
                BeforeViewNode(this, args);
            }

            IStepNode previousNode = _currentNode;

            _currentNode = node;

            node.Load();
            if (previousNode != null)
            {
                previousNode.Hide();
            }
            node.Show();
        }
예제 #5
0
        public void AttachNode(IStepNode node)
        {
            if (node == null)
            {
                throw new ArgumentNullException("node cannot be null");
            }

            // Place the new node in-between this node and the current next node
            IStepNode oldNext = _next;

            node.AttachTo(this);
            if (oldNext != null)
            {
                oldNext.AttachTo(node);
            }

            // Link the node to us
            _next = node;
        }
예제 #6
0
        public bool Forward()
        {
            if (_currentNode == null)
            {
                return(false);
            }
            if (!_currentNode.Save())
            {
                return(true);
            }

            IStepNode nextNode = _currentNode.Next;

            if (nextNode == null)
            {
                return(false);
            }

            ViewNode(nextNode);
            return(true);
        }
예제 #7
0
 public ViewNodeEventArgs(IStepNode nextNode, bool canGoBack, bool canGoForward)
 {
     NextNode      = nextNode;
     _canGoBack    = canGoBack;
     _canGoForward = canGoForward;
 }
예제 #8
0
 public void AttachTo(IStepNode node)
 {
     _previous = node;
 }
예제 #9
0
 /// <summary>
 /// Connects an IStepNode to one of the IBranchStep's branches.
 /// </summary>
 /// <param name="branch">The branch to connect to (see the concrete IBranchStep implementation this wraps).</param>
 /// <param name="node">The IStepNode that should be jumped to if the branch is selected.</param>
 public void ConnectBranch(T branch, IStepNode node)
 {
     node.AttachTo(this);
     _branches[branch] = node;
 }