本文整理汇总了C#中Dynamo.Models.WorkspaceModel.AddAndRegisterNode方法的典型用法代码示例。如果您正苦于以下问题:C# WorkspaceModel.AddAndRegisterNode方法的具体用法?C# WorkspaceModel.AddAndRegisterNode怎么用?C# WorkspaceModel.AddAndRegisterNode使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Dynamo.Models.WorkspaceModel
的用法示例。
在下文中一共展示了WorkspaceModel.AddAndRegisterNode方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Collapse
//.........这里部分代码省略.........
}
//Connect outputs to new node
outConnectors.AddRange(
from output in outputs
let outputSenderNode = output.Item1
let outputSenderData = output.Item2
let outputReceiverData = output.Item3.Item1
let outputReceiverNode = output.Item3.Item2
select
Tuple.Create(
outputReceiverNode,
outportList.FindIndex(
x => x.Item1 == outputSenderNode && x.Item2 == outputSenderData),
outputReceiverData));
}
else
{
foreach (var hanging in
selectedNodeSet.SelectMany(
node =>
Enumerable.Range(0, node.OutPortData.Count)
.Where(port => !node.HasOutput(port))
.Select(port => new { node, port })).Distinct())
{
//Create Symbol Node
var node = new Output
{
Symbol = hanging.node.OutPortData[hanging.port].NickName,
X = rightMost + 75 - leftShift
};
node.Y = i*(50 + node.Height);
node.SetNickNameFromAttribute();
newNodes.Add(node);
ConnectorModel.Make(hanging.node, node, hanging.port, 0);
i++;
}
}
#endregion
var newId = Guid.NewGuid();
newWorkspace = new CustomNodeWorkspaceModel(
nodeFactory,
newNodes,
Enumerable.Empty<NoteModel>(),
newAnnotations,
Enumerable.Empty<PresetModel>(),
new WorkspaceInfo()
{
X = 0,
Y = 0,
Name = args.Name,
Category = args.Category,
Description = args.Description,
ID = newId.ToString(),
FileName = string.Empty
},
currentWorkspace.ElementResolver);
newWorkspace.HasUnsavedChanges = true;
RegisterCustomNodeWorkspace(newWorkspace);
var collapsedNode = CreateCustomNodeInstance(newId, isTestMode: isTestMode);
collapsedNode.X = avgX;
collapsedNode.Y = avgY;
currentWorkspace.AddAndRegisterNode(collapsedNode, centered: false);
undoRecorder.RecordCreationForUndo(collapsedNode);
foreach (var connector in
inConnectors.Select((x, idx) => new { node = x.Item1, from = x.Item2, to = idx })
.Select(
nodeTuple =>
ConnectorModel.Make(
nodeTuple.node,
collapsedNode,
[email protected],
nodeTuple.to))
.Where(connector => connector != null))
{
undoRecorder.RecordCreationForUndo(connector);
}
foreach (var connector in
outConnectors.Select(
nodeTuple =>
ConnectorModel.Make(
collapsedNode,
nodeTuple.Item1,
nodeTuple.Item2,
nodeTuple.Item3)).Where(connector => connector != null))
{
undoRecorder.RecordCreationForUndo(connector);
}
}
return newWorkspace;
}