本文整理汇总了C#中CustomNodeDefinition.SyncWithWorkspace方法的典型用法代码示例。如果您正苦于以下问题:C# CustomNodeDefinition.SyncWithWorkspace方法的具体用法?C# CustomNodeDefinition.SyncWithWorkspace怎么用?C# CustomNodeDefinition.SyncWithWorkspace使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CustomNodeDefinition
的用法示例。
在下文中一共展示了CustomNodeDefinition.SyncWithWorkspace方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: NewCustomNodeWorkspace
public CustomNodeDefinition NewCustomNodeWorkspace( Guid id,
string name,
string category,
string description,
bool makeCurrentWorkspace,
double workspaceOffsetX = 0,
double workspaceOffsetY = 0)
{
var workSpace = new CustomNodeWorkspaceModel(this,
name, category, description, workspaceOffsetX, workspaceOffsetY)
{
WatchChanges = true
};
Workspaces.Add(workSpace);
var functionDefinition = new CustomNodeDefinition(id)
{
WorkspaceModel = workSpace
};
functionDefinition.SyncWithWorkspace(this, true, true);
if (makeCurrentWorkspace)
{
CurrentWorkspace = workSpace;
}
return functionDefinition;
}
示例2: Collapse
//.........这里部分代码省略.........
x => x.InnerNodeInputSender == outputSenderNode)
.OuterNodeInPortData;
int targetPortIndex =
curriedNode.OuterNodePortDataList.IndexOf(targetPort);
//Connect it (new dynConnector)
newNodeWorkspace.AddConnection(
outputSenderNode,
curriedNode.InnerNode,
outputSenderData,
targetPortIndex + 1);
}
}
}
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 = newNodeWorkspace.AddNode<Output>();
node.Symbol = hanging.node.OutPortData[hanging.port].NickName;
node.SetNickNameFromAttribute();
//store the element in the elements list
node.DisableReporting();
node.X = rightMost + 75 - leftShift;
node.Y = i*(50 + node.Height);
newNodeWorkspace.AddConnection(hanging.node, node, hanging.port, 0);
i++;
}
}
#endregion
// save and load the definition from file
newNodeDefinition.SyncWithWorkspace(dynamoModel, true, true);
dynamoModel.Workspaces.Add(newNodeWorkspace);
string name = newNodeDefinition.FunctionId.ToString();
var collapsedNode = currentWorkspace.AddNode(avgX, avgY, name);
undoRecorder.RecordCreationForUndo(collapsedNode);
// place the node as intended, not centered
collapsedNode.X = avgX;
collapsedNode.Y = avgY;
collapsedNode.DisableReporting();
foreach (
var nodeTuple in
inConnectors.Select(
(x, idx) => new { node = x.Item1, from = x.Item2, to = idx }))
{
var conn = currentWorkspace.AddConnection(
nodeTuple.node,
collapsedNode,
nodeTuple.from,
nodeTuple.to);
if (conn != null)
{
undoRecorder.RecordCreationForUndo(conn);
}
}
foreach (var nodeTuple in outConnectors)
{
var conn = currentWorkspace.AddConnection(
collapsedNode,
nodeTuple.Item1,
nodeTuple.Item2,
nodeTuple.Item3);
if (conn != null)
{
undoRecorder.RecordCreationForUndo(conn);
}
}
collapsedNode.EnableReporting();
currentWorkspace.EnableReporting();
foreach (var node in newNodeWorkspace.Nodes)
node.EnableReporting();
newNodeWorkspace.WatchChanges = true;
}
}