本文整理汇总了C#中FunctionDefinition.SyncWithWorkspace方法的典型用法代码示例。如果您正苦于以下问题:C# FunctionDefinition.SyncWithWorkspace方法的具体用法?C# FunctionDefinition.SyncWithWorkspace怎么用?C# FunctionDefinition.SyncWithWorkspace使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FunctionDefinition
的用法示例。
在下文中一共展示了FunctionDefinition.SyncWithWorkspace方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Collapse
//.........这里部分代码省略.........
i++;
}
}
//Connect outputs to new node
foreach (var output in outputs)
{
//Node to be connected to in CurrentWorkspace
NodeModel outputSenderNode = output.Item1;
//Port to be connected to on outPutNode_outer
int outputSenderData = output.Item2;
int outputReceiverData = output.Item3.Item1;
NodeModel outputReceiverNode = output.Item3.Item2;
var curriedNode = curriedNodeArgs.FirstOrDefault(
x => x.OuterNode == outputReceiverNode);
if (curriedNode == null)
{
// we create the connectors in the current space later
//MVVM : replaced multiple dynNodeView refrences with dynNode
outConnectors.Add(
Tuple.Create(
outputReceiverNode,
outportList.FindIndex(
x => x.Item1 == outputSenderNode && x.Item2 == outputSenderData),
outputReceiverData));
}
else
{
int targetPort = curriedNode.Inputs
.First(
x => x.InnerNodeInputSender == outputSenderNode)
.OuterNodeInPortData;
int targetPortIndex = curriedNode.OuterNodePortDataList.IndexOf(targetPort);
//Connect it (new dynConnector)
var conn = ConnectorModel.Make(
outputSenderNode,
curriedNode.InnerNode,
outputSenderData,
targetPortIndex + 1,
PortType.INPUT);
if (conn != null)
newNodeWorkspace.Connectors.Add(conn);
}
}
#endregion
// save and load the definition from file
newNodeDefinition.SyncWithWorkspace(true, true);
dynSettings.Controller.DynamoModel.Workspaces.Add(newNodeWorkspace);
string name = newNodeDefinition.FunctionId.ToString();
var collapsedNode = dynSettings.Controller.DynamoModel.CreateNode(avgX, avgY, name);
// place the node as intended, not centered
collapsedNode.X = avgX;
collapsedNode.Y = avgY;
collapsedNode.DisableReporting();
foreach (var nodeTuple in inConnectors)
{
var conn = ConnectorModel.Make(
nodeTuple.Item1,
collapsedNode,
nodeTuple.Item2,
nodeTuple.Item3,
PortType.INPUT);
if (conn != null)
currentWorkspace.Connectors.Add(conn);
}
foreach (var nodeTuple in outConnectors)
{
var conn = ConnectorModel.Make(
collapsedNode,
nodeTuple.Item1,
nodeTuple.Item2,
nodeTuple.Item3,
PortType.INPUT);
if (conn != null)
currentWorkspace.Connectors.Add(conn);
}
collapsedNode.EnableReporting();
currentWorkspace.EnableReporting();
newNodeWorkspace.WatchChanges = true;
}
示例2: NewCustomNodeWorkspace
public FunctionDefinition NewCustomNodeWorkspace( Guid id,
string name,
string category,
string description,
bool makeCurrentWorkspace,
double workspaceOffsetX = 0,
double workspaceOffsetY = 0)
{
var workSpace = new CustomNodeWorkspaceModel(
name, category, description, workspaceOffsetX, workspaceOffsetY)
{
WatchChanges = true
};
Workspaces.Add(workSpace);
workSpace.Nodes.ToList();
workSpace.Connectors.ToList();
var functionDefinition = new FunctionDefinition(id)
{
WorkspaceModel = workSpace
};
functionDefinition.SyncWithWorkspace(true, true);
if (makeCurrentWorkspace)
{
CurrentWorkspace = workSpace;
}
return functionDefinition;
}