예제 #1
0
        public void Undo(UcTreeDesigner designer)
        {
            //Reset the Positions:
            _mergedNode.includedNodes
            .ForEach(n => n.PosX -= _mergedNode.PosX)
            .ForEach(n => n.PosY -= _mergedNode.PosY)
            .ForEach(n => designer.RemoveNode(n));

            //Re-Apply the Inputs:
            foreach (var node in _mergedNode.includedNodes)
            {
                _newConnections
                .Where(c => c.InputNode == node)
                .ForEach(c => node.SetInput(c.InputIndex, c.OutputNode));
            }

            //Finally Readd the node:
            designer.AddNode(_mergedNode);

            //Reapply all connections outside of the Node:
            _newConnections
            .Where(c => !_mergedNode.includedNodes.Contains(c.InputNode))
            .Select(c => new Connection(_mergedNode, c.InputNode, c.InputIndex))
            .ForEach(designer.AddConnection);
            _newConnections
            .Where(c => !_mergedNode.includedNodes.Contains(c.OutputNode))
            .Select(c => new Connection(c.OutputNode, _mergedNode, c.InputIndex))
            .ForEach(designer.AddConnection);
        }
예제 #2
0
        public void Redo(UcTreeDesigner designer)
        {
            //Reset the Positions:
            _mergedNode.includedNodes
            .ForEach(n => n.PosX -= _mergedNode.PosX)
            .ForEach(n => n.PosY -= _mergedNode.PosY)
            .ForEach(n => designer.RemoveNode(n));

            //Re-Apply the Inputs:
            foreach (var node in _mergedNode.includedNodes)
            {
                _connectionsAfterUnmerge
                .Where(c => c.InputNode == node)
                .ForEach(c => node.SetInput(c.InputIndex, c.OutputNode));
            }

            //Finally Readd the node:
            designer.AddNode(_mergedNode);

            //Readd connections from outside the Bundle:
            _oldConnections.ForEach(designer.AddConnection);
        }
예제 #3
0
 public void Redo(UcTreeDesigner designer)
 {
     nodes.ForEach(n => designer.AddNode(n));
 }
예제 #4
0
 public void Undo(UcTreeDesigner designer)
 {
     nodes.ForEach(n => designer.AddNode(n));
     connections.ForEach(c => designer.AddConnection(c));
 }