本文整理汇总了C#中CustomNodeDefinition.Compile方法的典型用法代码示例。如果您正苦于以下问题:C# CustomNodeDefinition.Compile方法的具体用法?C# CustomNodeDefinition.Compile怎么用?C# CustomNodeDefinition.Compile使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类CustomNodeDefinition
的用法示例。
在下文中一共展示了CustomNodeDefinition.Compile方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetDefinitionFromPath
//.........这里部分代码省略.........
#endregion
#region instantiate connectors
foreach (XmlNode connector in cNodesList.ChildNodes)
{
XmlAttribute guidStartAttrib = connector.Attributes[0];
XmlAttribute intStartAttrib = connector.Attributes[1];
XmlAttribute guidEndAttrib = connector.Attributes[2];
XmlAttribute intEndAttrib = connector.Attributes[3];
XmlAttribute portTypeAttrib = connector.Attributes[4];
var guidStart = new Guid(guidStartAttrib.Value);
var guidEnd = new Guid(guidEndAttrib.Value);
int startIndex = Convert.ToInt16(intStartAttrib.Value);
int endIndex = Convert.ToInt16(intEndAttrib.Value);
var portType = ((PortType)Convert.ToInt16(portTypeAttrib.Value));
//find the elements to connect
NodeModel start = null;
NodeModel end = null;
foreach (NodeModel e in ws.Nodes)
{
if (e.GUID == guidStart)
{
start = e;
}
else if (e.GUID == guidEnd)
{
end = e;
}
if (start != null && end != null)
{
break;
}
}
try
{
var newConnector = ws.AddConnection(
start, end,
startIndex, endIndex,
portType);
}
catch
{
dynamoModel.WriteToLog(string.Format("ERROR : Could not create connector between {0} and {1}.", start.NickName, end.NickName));
}
}
#endregion
#region instantiate notes
if (nNodesList != null)
{
foreach (XmlNode note in nNodesList.ChildNodes)
{
XmlAttribute textAttrib = note.Attributes[0];
XmlAttribute xAttrib = note.Attributes[1];
XmlAttribute yAttrib = note.Attributes[2];
string text = textAttrib.Value;
double x = Convert.ToDouble(xAttrib.Value, CultureInfo.InvariantCulture);
double y = Convert.ToDouble(yAttrib.Value, CultureInfo.InvariantCulture);
ws.AddNote(false, x, y, text, Guid.NewGuid());
}
}
#endregion
foreach (var e in ws.Nodes)
e.EnableReporting();
def.IsBeingLoaded = false;
def.Compile(this.dynamoModel, this.dynamoModel.EngineController);
ws.WatchChanges = true;
OnGetDefinitionFromPath(def);
}
catch (Exception ex)
{
dynamoModel.WriteToLog("There was an error opening the workbench.");
dynamoModel.WriteToLog(ex);
if (DynamoModel.IsTestMode)
throw ex; // Rethrow for NUnit.
def = null;
return false;
}
return true;
}