本文整理汇总了C#中FunctionDefinition.CompileAndAddToEnvironment方法的典型用法代码示例。如果您正苦于以下问题:C# FunctionDefinition.CompileAndAddToEnvironment方法的具体用法?C# FunctionDefinition.CompileAndAddToEnvironment怎么用?C# FunctionDefinition.CompileAndAddToEnvironment使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类FunctionDefinition
的用法示例。
在下文中一共展示了FunctionDefinition.CompileAndAddToEnvironment方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: GetDefinitionFromPath
//.........这里部分代码省略.........
{
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);
PortType portType = ((PortType)Convert.ToInt16(portTypeAttrib.Value));
//find the elements to connect
NodeModel start = null;
NodeModel end = null;
if (badNodes.Contains(guidStart) || badNodes.Contains(guidEnd))
continue;
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 = ConnectorModel.Make(
start, end,
startIndex, endIndex,
portType);
if (newConnector != null)
ws.Connectors.Add(newConnector);
}
catch
{
//DynamoCommands.WriteToLogCmd.Execute(string.Format("ERROR : Could not create connector between {0} and {1}.", start.NickName, end.NickName));
dynSettings.Controller.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);
Guid guid = Guid.NewGuid();
var command = new DynCmd.CreateNoteCommand(guid, text, x, y, false);
dynSettings.Controller.DynamoModel.AddNoteInternal(command, ws);
}
}
#endregion
foreach (var e in ws.Nodes)
e.EnableReporting();
def.CompileAndAddToEnvironment(controller.FSchemeEnvironment);
ws.WatchChanges = true;
this.OnGetDefinitionFromPath(def);
}
catch (Exception ex)
{
dynSettings.Controller.DynamoModel.WriteToLog("There was an error opening the workbench.");
dynSettings.Controller.DynamoModel.WriteToLog(ex);
if (DynamoController.IsTestMode)
Assert.Fail(ex.Message);
def = null;
return false;
}
return true;
}