本文整理汇总了C#中XmlElementHelper.ReadDouble方法的典型用法代码示例。如果您正苦于以下问题:C# XmlElementHelper.ReadDouble方法的具体用法?C# XmlElementHelper.ReadDouble怎么用?C# XmlElementHelper.ReadDouble使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XmlElementHelper
的用法示例。
在下文中一共展示了XmlElementHelper.ReadDouble方法的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: DummyNode
public DummyNode(int inputCount, int outputCount, string legacyName, XmlElement originalElement, string legacyAssembly, Nature nodeNature)
{
InputCount = inputCount;
OutputCount = outputCount;
LegacyNodeName = legacyName;
NickName = legacyName;
OriginalNodeContent = originalElement;
LegacyAssembly = legacyAssembly;
NodeNature = nodeNature;
Description = GetDescription();
ShouldDisplayPreviewCore = false;
UpdatePorts();
// Take the position from the old node (because a dummy node
// should always be created at the location of the old node).
var helper = new XmlElementHelper(originalElement);
X = helper.ReadDouble("x", 0.0);
Y = helper.ReadDouble("y", 0.0);
//Take the GUID from the old node (dummy nodes should have their
//GUID's. This will allow the Groups to work as expected. MAGN-7568)
GUID = helper.ReadGuid("guid", this.GUID);
}
示例2: 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);
}
示例3: 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);
}
示例4: 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();
}
示例5: TestDoubleAttributes
public void TestDoubleAttributes()
{
XmlElement element = xmlDocument.CreateElement("element");
// Test attribute writing.
XmlElementHelper writer = new XmlElementHelper(element);
writer.SetAttribute("ValidName", -12.34);
// Test reading of existing attribute.
XmlElementHelper reader = new XmlElementHelper(element);
Assert.AreEqual(-12.34, reader.ReadDouble("ValidName"));
// Test reading of non-existence attribute with default value.
Assert.AreEqual(56.78, reader.ReadDouble("InvalidName", 56.78));
// Test reading of non-existence attribute without default value.
Assert.Throws<InvalidOperationException>(() =>
{
reader.ReadDouble("InvalidName");
});
}
示例6: DeserializeCore
protected override void DeserializeCore(XmlElement element, SaveContext context)
{
XmlElementHelper helper = new XmlElementHelper(element);
this.GUID = helper.ReadGuid("guid", this.GUID);
this.annotationText = helper.ReadString("annotationText", Resources.GroupDefaultText);
this.X = helper.ReadDouble("left", DoubleValue);
this.Y = helper.ReadDouble("top", DoubleValue);
this.width = helper.ReadDouble("width", DoubleValue);
this.height = helper.ReadDouble("height", DoubleValue);
this.background = helper.ReadString("backgrouund", "");
this.fontSize = helper.ReadDouble("fontSize", fontSize);
this.textBlockHeight = helper.ReadDouble("TextblockHeight", DoubleValue);
this.InitialTop = helper.ReadDouble("InitialTop", DoubleValue);
this.InitialHeight = helper.ReadDouble("InitialHeight", DoubleValue);
//Deserialize Selected models
if (element.HasChildNodes)
{
var listOfModels = new List<ModelBase>();
foreach (var childnode in element.ChildNodes)
{
XmlElementHelper mhelper = new XmlElementHelper(childnode as XmlElement);
if (SelectedModels != null)
{
var result = mhelper.ReadGuid("ModelGuid", new Guid());
ModelBase model = null;
model = ModelBaseRequested != null ? ModelBaseRequested(result) :
SelectedModels.FirstOrDefault(x => x.GUID == result);
listOfModels.Add(model);
}
}
SelectedModels = listOfModels;
}
//On any Undo Operation, current values are restored to previous values.
//These properties should be Raised, so that they get the correct value on Undo.
RaisePropertyChanged("Background");
RaisePropertyChanged("FontSize");
RaisePropertyChanged("AnnotationText");
RaisePropertyChanged("SelectedModels");
}
示例7: DeserializeCore
internal static DragSelectionCommand DeserializeCore(XmlElement element)
{
XmlElementHelper helper = new XmlElementHelper(element);
double x = helper.ReadDouble("X");
double y = helper.ReadDouble("Y");
int op = helper.ReadInteger("DragOperation");
return new DragSelectionCommand(new Point(x, y), ((Operation)op));
}
示例8: DeserializeCore
protected override void DeserializeCore(XmlElement element, SaveContext context)
{
XmlElementHelper helper = new XmlElementHelper(element);
this.GUID = helper.ReadGuid("guid", Guid.NewGuid());
// Resolve node nick name.
string nickName = helper.ReadString("nickname", string.Empty);
if (!string.IsNullOrEmpty(nickName))
this.nickName = nickName;
else
{
System.Type type = this.GetType();
var attribs = type.GetCustomAttributes(typeof(NodeNameAttribute), true);
NodeNameAttribute attrib = attribs[0] as NodeNameAttribute;
if (null != attrib)
this.nickName = attrib.Name;
}
this.X = helper.ReadDouble("x", 0.0);
this.Y = helper.ReadDouble("y", 0.0);
this.isVisible = helper.ReadBoolean("isVisible", true);
this.isUpstreamVisible = helper.ReadBoolean("isUpstreamVisible", true);
this.argumentLacing = helper.ReadEnum("lacing", LacingStrategy.Disabled);
if (context == SaveContext.Undo)
{
// Fix: MAGN-159 (nodes are not editable after undo/redo).
interactionEnabled = helper.ReadBoolean("interactionEnabled", true);
this.state = helper.ReadEnum("nodeState", ElementState.ACTIVE);
// We only notify property changes in an undo/redo operation. Normal
// operations like file loading or copy-paste have the models created
// in different ways and their views will always be up-to-date with
// respect to their models.
RaisePropertyChanged("InteractionEnabled");
RaisePropertyChanged("State");
RaisePropertyChanged("NickName");
RaisePropertyChanged("ArgumentLacing");
RaisePropertyChanged("IsVisible");
RaisePropertyChanged("IsUpstreamVisible");
// Notify listeners that the position of the node has changed,
// then all connected connectors will also redraw themselves.
this.ReportPosition();
}
}
示例9: DeserializeCore
protected override void DeserializeCore(XmlElement nodeElement, SaveContext context)
{
var helper = new XmlElementHelper(nodeElement);
if (context != SaveContext.Copy)
GUID = helper.ReadGuid("guid", GUID);
// Resolve node nick name.
string name = helper.ReadString("nickname", string.Empty);
if (!string.IsNullOrEmpty(name))
nickName = name;
else
{
Type type = GetType();
object[] attribs = type.GetCustomAttributes(typeof(NodeNameAttribute), true);
var attrib = attribs[0] as NodeNameAttribute;
if (null != attrib)
nickName = attrib.Name;
}
X = helper.ReadDouble("x", 0.0);
Y = helper.ReadDouble("y", 0.0);
isVisible = helper.ReadBoolean("isVisible", true);
isUpstreamVisible = helper.ReadBoolean("isUpstreamVisible", true);
argumentLacing = helper.ReadEnum("lacing", LacingStrategy.Disabled);
var portInfoProcessed = new HashSet<int>();
//read port information
foreach (XmlNode subNode in nodeElement.ChildNodes)
{
if (subNode.Name == "PortInfo")
{
int index = int.Parse(subNode.Attributes["index"].Value);
if (index < InPorts.Count)
{
portInfoProcessed.Add(index);
bool def = bool.Parse(subNode.Attributes["default"].Value);
inPorts[index].UsingDefaultValue = def;
}
}
}
//set defaults
foreach (
var port in
inPorts.Select((x, i) => new { x, i }).Where(x => !portInfoProcessed.Contains(x.i)))
port.x.UsingDefaultValue = false;
if (context == SaveContext.Undo)
{
// Fix: MAGN-159 (nodes are not editable after undo/redo).
//interactionEnabled = helper.ReadBoolean("interactionEnabled", true);
state = helper.ReadEnum("nodeState", ElementState.Active);
// We only notify property changes in an undo/redo operation. Normal
// operations like file loading or copy-paste have the models created
// in different ways and their views will always be up-to-date with
// respect to their models.
RaisePropertyChanged("InteractionEnabled");
RaisePropertyChanged("State");
RaisePropertyChanged("NickName");
RaisePropertyChanged("ArgumentLacing");
RaisePropertyChanged("IsVisible");
RaisePropertyChanged("IsUpstreamVisible");
// Notify listeners that the position of the node has changed,
// then all connected connectors will also redraw themselves.
ReportPosition();
}
}
示例10: DeserializeCore
internal static CreateAndConnectNodeCommand DeserializeCore(XmlElement element)
{
var helper = new XmlElementHelper(element);
string newNodeName = helper.ReadString("NewNodeName");
double x = helper.ReadDouble("X");
double y = helper.ReadDouble("Y");
bool createAsDownstreamNode = helper.ReadBoolean("CreateAsDownstreamNode");
bool addNewNodeToSelection = helper.ReadBoolean("AddNewNodeToSelection");
var guids = DeserializeGuid(element, helper).ToList();
var newNodeGuid = guids.ElementAt(0);
var existingNodeGuid = guids.ElementAt(1);
int outPortIndex = helper.ReadInteger("OutPortIndex");
int inPortIndex = helper.ReadInteger("InPortIndex");
return new CreateAndConnectNodeCommand(newNodeGuid, existingNodeGuid, newNodeName, outPortIndex, inPortIndex,
x, y, createAsDownstreamNode, addNewNodeToSelection);
}