本文整理汇总了C#中SaveContext类的典型用法代码示例。如果您正苦于以下问题:C# SaveContext类的具体用法?C# SaveContext怎么用?C# SaveContext使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
SaveContext类属于命名空间,在下文中一共展示了SaveContext类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的C#代码示例。
示例1: SaveNode
protected override void SaveNode(XmlDocument xmlDoc, XmlElement nodeElement, SaveContext context)
{
Controller.SaveNode(xmlDoc, nodeElement, context);
var outEl = xmlDoc.CreateElement("Name");
outEl.SetAttribute("value", NickName);
nodeElement.AppendChild(outEl);
outEl = xmlDoc.CreateElement("Description");
outEl.SetAttribute("value", Description);
nodeElement.AppendChild(outEl);
outEl = xmlDoc.CreateElement("Inputs");
foreach (string input in InPortData.Select(x => x.NickName))
{
XmlElement inputEl = xmlDoc.CreateElement("Input");
inputEl.SetAttribute("value", input);
outEl.AppendChild(inputEl);
}
nodeElement.AppendChild(outEl);
outEl = xmlDoc.CreateElement("Outputs");
foreach (string output in OutPortData.Select(x => x.NickName))
{
XmlElement outputEl = xmlDoc.CreateElement("Output");
outputEl.SetAttribute("value", output);
outEl.AppendChild(outputEl);
}
nodeElement.AppendChild(outEl);
}
开发者ID:khoaho,项目名称:Dynamo,代码行数:30,代码来源:Function.cs
示例2: SerializeCore
protected override void SerializeCore(XmlElement element, SaveContext context)
{
base.SerializeCore(element, context); // Base implementation must be called.
var helper = new XmlElementHelper(element);
helper.SetAttribute("exportedUnit", SelectedExportedUnit.ToString());
}
开发者ID:ankushraizada,项目名称:Dynamo,代码行数:7,代码来源:ExportWithUnits.cs
示例3: SaveNode
//public override FScheme.Value Evaluate(FSharpList<FScheme.Value> args)
//{
// dynRevitSettings.ElementsContainers.Push(ElementsContainer);
// var result = base.Evaluate(args);
// dynRevitSettings.ElementsContainers.Pop();
// return result;
//}
protected override void SaveNode(XmlDocument xmlDoc, XmlElement nodeElement, SaveContext context)
{
base.SaveNode(xmlDoc, nodeElement, context);
if (context == SaveContext.Copy)
return;
foreach (var node in ElementsContainer.Nodes)
{
var outEl = xmlDoc.CreateElement("InnerNode");
outEl.SetAttribute("id", node.ToString());
foreach (var run in ElementsContainer[node])
{
var runEl = xmlDoc.CreateElement("Run");
foreach (var id in run)
{
Element e;
if (dynUtils.TryGetElement(id, out e))
{
var elementStore = xmlDoc.CreateElement("Element");
elementStore.InnerText = e.UniqueId;
runEl.AppendChild(elementStore);
}
}
outEl.AppendChild(runEl);
}
nodeElement.AppendChild(outEl);
}
}
开发者ID:algobasket,项目名称:Dynamo,代码行数:41,代码来源:FunctionWithRevit.cs
示例4: SerializeCore
protected override void SerializeCore(XmlElement element, SaveContext context)
{
base.SerializeCore(element, context); //Base implementation must be called
var formStringNode = element.OwnerDocument.CreateElement("FormulaText");
formStringNode.InnerText = FormulaString;
element.AppendChild(formStringNode);
}
开发者ID:Conceptual-Design,项目名称:Dynamo,代码行数:7,代码来源:Formula.cs
示例5: DeserializeCore
protected override void DeserializeCore(XmlElement element, SaveContext context)
{
base.DeserializeCore(element, context); //Base implementation must be called
if (context == SaveContext.Undo)
{
//Reads in the new number of ports required from the data stored in the Xml Element
//during Serialize (nextLength). Changes the current In Port Data to match the
//required size by adding or removing port data.
int currLength = InPortData.Count;
XmlNodeList inNodes = element.SelectNodes("Input");
int nextLength = inNodes.Count;
if (nextLength > currLength)
{
for (; currLength < nextLength; currLength++)
{
XmlNode subNode = inNodes.Item(currLength);
string nickName = subNode.Attributes["name"].Value;
InPortData.Add(new PortData(nickName, "", typeof(object)));
}
}
else if (nextLength < currLength)
InPortData.RemoveRange(nextLength, currLength - nextLength);
RegisterAllPorts();
}
}
开发者ID:TheChosen0ne,项目名称:Dynamo,代码行数:27,代码来源:VariableInputNode.cs
示例6: SaveNode
SaveNode(XmlDocument xmlDoc, XmlElement nodeElement, SaveContext context)
{
//Don't copy over stored references
if (context == SaveContext.Copy)
return;
//Only save elements in the home workspace
if (WorkSpace is CustomNodeWorkspaceModel)
return;
foreach (var run in elements)
{
var outEl = xmlDoc.CreateElement("Run");
foreach (var id in run)
{
Element e;
if (dynUtils.TryGetElement(id, out e))
{
var elementStore = xmlDoc.CreateElement("Element");
elementStore.InnerText = e.UniqueId;
outEl.AppendChild(elementStore);
}
}
nodeElement.AppendChild(outEl);
}
}
开发者ID:heegwon,项目名称:Dynamo,代码行数:27,代码来源:RevitTransactionNode.cs
示例7: SaveNode
protected override void SaveNode(XmlDocument xmlDoc, XmlElement nodeElement, SaveContext context)
{
//Debug.WriteLine(pd.Object.GetType().ToString());
XmlElement outEl = xmlDoc.CreateElement(typeof(double).FullName);
outEl.SetAttribute("value", port.PortName);
nodeElement.AppendChild(outEl);
}
开发者ID:algobasket,项目名称:Dynamo,代码行数:7,代码来源:dynArduino.cs
示例8: SerializeCore
protected override void SerializeCore(XmlElement element, SaveContext context)
{
var helper = new XmlElementHelper(element);
helper.SetAttribute("guid", GUID);
helper.SetAttribute("text", Text);
helper.SetAttribute("x", X);
helper.SetAttribute("y", Y);
}
开发者ID:ankushraizada,项目名称:Dynamo,代码行数:8,代码来源:NoteModel.cs
示例9: DeserializeCore
protected override void DeserializeCore(XmlElement element, SaveContext context)
{
XmlElementHelper helper = new XmlElementHelper(element);
this.GUID = helper.ReadGuid("guid", this.GUID);
this.Text = helper.ReadString("text", "New Note");
this.X = helper.ReadDouble("x", 0.0);
this.Y = helper.ReadDouble("y", 0.0);
}
开发者ID:algobasket,项目名称:Dynamo,代码行数:8,代码来源:NoteModel.cs
示例10: DeserializeCore
protected override void DeserializeCore(XmlElement nodeElement, SaveContext context)
{
var helper = new XmlElementHelper(nodeElement);
GUID = helper.ReadGuid("guid", GUID);
Text = helper.ReadString("text", "New Note");
X = helper.ReadDouble("x", 0.0);
Y = helper.ReadDouble("y", 0.0);
}
开发者ID:norbertzsiros,项目名称:Dynamo,代码行数:8,代码来源:NoteModel.cs
示例11: SerializeCore
protected override void SerializeCore(XmlElement nodeElement, SaveContext context)
{
base.SerializeCore(nodeElement, context);
XmlElement outEl = nodeElement.OwnerDocument.CreateElement(typeof(string).FullName);
var helper = new XmlElementHelper(outEl);
helper.SetAttribute("value", SerializeValue());
nodeElement.AppendChild(outEl);
}
开发者ID:norbertzsiros,项目名称:Dynamo,代码行数:9,代码来源:BaseTypes.cs
示例12: DeserializeCore
protected override void DeserializeCore(XmlElement nodeElement, SaveContext context)
{
var helper = new XmlElementHelper(nodeElement);
GUID = helper.ReadGuid("guid", GUID);
Text = helper.ReadString("text", "New Note");
X = helper.ReadDouble("x", 0.0);
Y = helper.ReadDouble("y", 0.0);
// Notify listeners that the position of the note has changed,
// then parent group will also redraw itself.
ReportPosition();
}
开发者ID:ankushraizada,项目名称:Dynamo,代码行数:12,代码来源:NoteModel.cs
示例13: DeserializeCore
protected override void DeserializeCore(XmlElement nodeElement, SaveContext context)
{
base.DeserializeCore(nodeElement, context);
foreach (XmlNode subNode in nodeElement.ChildNodes)
{
if (subNode.Name.Equals(typeof(string).FullName))
{
foreach (XmlAttribute attr in subNode.Attributes)
{
if (attr.Name.Equals("value"))
{
Value = DeserializeValue(attr.Value);
}
}
}
}
}
开发者ID:norbertzsiros,项目名称:Dynamo,代码行数:17,代码来源:BaseTypes.cs
示例14: DeserializeCore
protected override void DeserializeCore(XmlElement nodeElement, SaveContext context)
{
base.DeserializeCore(nodeElement, context); //Base implementation must be called
if (nodeElement.Attributes != null)
{
var formulaAttr = nodeElement.Attributes["formula"];
if (formulaAttr != null)
{
FormulaString = formulaAttr.Value;
return;
}
}
var formStringNode = nodeElement.ChildNodes.Cast<XmlNode>().FirstOrDefault(childNode => childNode.Name == "FormulaText");
FormulaString = formStringNode != null
? formStringNode.InnerText
: nodeElement.InnerText;
}
开发者ID:ksobon,项目名称:Dynamo,代码行数:19,代码来源:Formula.cs
示例15: DeserializeCore
protected override void DeserializeCore(XmlElement element, SaveContext context)
{
base.DeserializeCore(element, context); //Base implementation must be called
if (context != SaveContext.Undo) return;
var helper = new XmlElementHelper(element);
NickName = helper.ReadString("functionName");
Controller.DeserializeCore(element, context);
XmlNodeList inNodes = element.SelectNodes("functionInput");
XmlNodeList outNodes = element.SelectNodes("functionOutput");
var inData =
inNodes.Cast<XmlNode>()
.Select(
(inputNode, i) =>
new
{
data = new PortData(inputNode.Attributes[0].Value, "Input #" + (i + 1)),
idx = i
});
foreach (var dataAndIdx in inData)
{
if (InPortData.Count > dataAndIdx.idx)
InPortData[dataAndIdx.idx] = dataAndIdx.data;
else
InPortData.Add(dataAndIdx.data);
}
var outData =
outNodes.Cast<XmlNode>()
.Select(
(outputNode, i) =>
new
{
data = new PortData(outputNode.Attributes[0].Value, "Output #" + (i + 1)),
idx = i
});
foreach (var dataAndIdx in outData)
{
if (OutPortData.Count > dataAndIdx.idx)
OutPortData[dataAndIdx.idx] = dataAndIdx.data;
else
OutPortData.Add(dataAndIdx.data);
}
//Added it the same way as LoadNode. But unsure of when 'Output' ChildNodes will
//be added to element. As of now I dont think it is added during serialize
#region Legacy output support
foreach (var portData in
from XmlNode subNode in element.ChildNodes
where subNode.Name.Equals("Output")
select new PortData(subNode.Attributes[0].Value, "function output"))
{
if (OutPortData.Any())
OutPortData[0] = portData;
else
OutPortData.Add(portData);
}
#endregion
RegisterAllPorts();
Description = helper.ReadString("functionDesc");
}
开发者ID:khoaho,项目名称:Dynamo,代码行数:72,代码来源:Function.cs
示例16: SerializeCore
protected override void SerializeCore(XmlElement element, SaveContext context)
{
base.SerializeCore(element, context); //Base implementation must be called
if (context != SaveContext.Undo) return;
var helper = new XmlElementHelper(element);
helper.SetAttribute("functionId", Definition.FunctionId.ToString());
helper.SetAttribute("functionName", NickName);
helper.SetAttribute("functionDesc", Description);
XmlDocument xmlDoc = element.OwnerDocument;
foreach (string input in InPortData.Select(x => x.NickName))
{
XmlElement inputEl = xmlDoc.CreateElement("functionInput");
inputEl.SetAttribute("inputValue", input);
element.AppendChild(inputEl);
}
foreach (string input in OutPortData.Select(x => x.NickName))
{
XmlElement outputEl = xmlDoc.CreateElement("functionOutput");
outputEl.SetAttribute("outputValue", input);
element.AppendChild(outputEl);
}
}
开发者ID:khoaho,项目名称:Dynamo,代码行数:26,代码来源:Function.cs
示例17: DeserializeCore
protected override void DeserializeCore(XmlElement element, SaveContext context)
{
// We are not deserializing the ports.
throw new NotImplementedException();
}
开发者ID:whztt07,项目名称:Dynamo,代码行数:5,代码来源:PortModel.cs
示例18: DeserializeCore
protected override void DeserializeCore(XmlElement element, SaveContext context)
{
base.DeserializeCore(element, context);
var helper = new XmlElementHelper(element);
var script = helper.ReadString("Script", string.Empty);
this._script = script;
}
开发者ID:kscalvin,项目名称:Dynamo,代码行数:8,代码来源:dynPython.cs
示例19: SerializeCore
protected override void SerializeCore(XmlElement element, SaveContext context)
{
base.SerializeCore(element, context);
var helper = new XmlElementHelper(element);
helper.SetAttribute("Script", this.Script);
}
开发者ID:kscalvin,项目名称:Dynamo,代码行数:7,代码来源:dynPython.cs
示例20: SaveNode
protected override void SaveNode(XmlDocument xmlDoc, XmlElement nodeElement, SaveContext context)
{
XmlElement script = xmlDoc.CreateElement("Script");
//script.InnerText = this.tb.Text;
script.InnerText = _script;
nodeElement.AppendChild(script);
}
开发者ID:kscalvin,项目名称:Dynamo,代码行数:7,代码来源:dynPython.cs
注:本文中的SaveContext类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论