Dynamo.Graph.Workspaces.WorkspaceModel.RecordUndoGraphLayout C# (CSharp) Method

RecordUndoGraphLayout() private method

This method adds relevant models to the undo recorder.
private RecordUndoGraphLayout ( bool isGroupLayout ) : void
isGroupLayout bool True if all the selected models are groups.
return void
        private void RecordUndoGraphLayout(bool isGroupLayout)
        {
            List<ModelBase> undoItems = new List<ModelBase>();

            if (!isGroupLayout)
            {
                // Add all selected items to the undo recorder
                undoItems.AddRange(Nodes);
                undoItems.AddRange(Notes);
                if (DynamoSelection.Instance.Selection.Count > 0)
                {
                    undoItems = undoItems.Where(x => x.IsSelected).ToList();
                }
            }
            else
            {
                // Add all models inside selected groups
                foreach (var group in Annotations)
                {
                    if (group.IsSelected)
                    {
                        group.SelectedModels.OfType<NodeModel>().ToList().ForEach(x => x.IsSelected = false);
                        undoItems.AddRange(group.SelectedModels);
                    }
                }
            }

            WorkspaceModel.RecordModelsForModification(undoItems, UndoRecorder);
        }
WorkspaceModel