Ejemplo n.º 1
0
        static State CreateStacksForNodes(State previousState, CreateStacksForNodesAction action)
        {
            VSGraphModel graphModel = (VSGraphModel)previousState.CurrentGraphModel;

            foreach (var stackOptions in action.Stacks)
            {
                var stack = graphModel.CreateStack(string.Empty, stackOptions.Position);
                if (stackOptions.NodeModels != null)
                {
                    stack.MoveStackedNodes(stackOptions.NodeModels, 0);
                }
            }
            return(previousState);
        }
Ejemplo n.º 2
0
        static State CreateStacksForNodes(State previousState, CreateStacksForNodesAction action)
        {
            VSGraphModel graphModel = (VSGraphModel)previousState.CurrentGraphModel;

            Undo.RegisterCompleteObjectUndo((Object)graphModel.AssetModel, "Move Stacked Node(s)");

            foreach (var stackOptions in action.Stacks)
            {
                var stack = graphModel.CreateStack(string.Empty, stackOptions.Position);
                if (stackOptions.NodeModels != null)
                {
                    stack.MoveStackedNodes(stackOptions.NodeModels, 0);
                }
            }
            return(previousState);
        }
Ejemplo n.º 3
0
        static State CreateStacksForNodes(State previousState, CreateStacksForNodesAction action)
        {
            VSGraphModel graphModel     = (VSGraphModel)previousState.CurrentGraphModel;
            var          affectedStacks = action.Stacks.SelectMany(stackOption => stackOption.NodeModels).OfType <NodeModel>()
                                          .Select(model => model.ParentStackModel).Distinct();

            foreach (var stack in affectedStacks)
            {
                Undo.RegisterCompleteObjectUndo(stack.NodeAssetReference, "Move Stacked Node(s)");
            }

            foreach (var stackOptions in action.Stacks)
            {
                var stack = graphModel.CreateStack(string.Empty, stackOptions.Position);
                if (stackOptions.NodeModels != null)
                {
                    stack.MoveStackedNodes(stackOptions.NodeModels, 0);
                }
            }
            return(previousState);
        }