public override void OnReadFromXmlNode(IXmlCodeReader reader, XmlNode node) { base.OnReadFromXmlNode(reader, node); XmlNodeList nodes = node.SelectNodes(string.Format(System.Globalization.CultureInfo.InvariantCulture, "{0}/{1}", XML_EVENTS, XmlTags.XML_Item)); if (nodes != null && nodes.Count > 0) { _events = new List <EventIcon>(); foreach (XmlNode eNode in nodes) { EventIcon ei = new EventIcon(this); ei.ReadFromXmlNode((XmlObjectReader)reader, eNode); _events.Add(ei); } } // _inPortList = new List <EventPortIn>(); XmlNodeList nds = node.SelectNodes(string.Format(System.Globalization.CultureInfo.InvariantCulture, "{0}/{1}", XML_INPORTS, XmlTags.XML_Item)); foreach (XmlNode n in nds) { EventPortIn pi = new EventPortIn(this); pi.OnReadFromXmlNode(reader, n); _inPortList.Add(pi); } }
public void ReadFromXmlNode(XmlObjectReader reader, XmlNode node) { XmlNode nd; object v; if (_label == null) { _label = new DrawingLabel(this); } if (XmlSerialization.ReadValueFromChildNode(node, XML_RelativePosition, out v)) { _label.RelativePosition.Location = (Point)v; nd = node.SelectSingleNode(XML_RelativePosition); _label.RelativePosition.IsXto0 = XmlSerialization.GetAttributeBool(nd, "xTo0", true); _label.RelativePosition.IsYto0 = XmlSerialization.GetAttributeBool(nd, "yTo0", true); } // XmlNode eNode = node.SelectSingleNode(XML_Event); try { _event = (IEvent)reader.ReadObject(eNode, null); _label.Text = _event.ShortDisplayName; } catch (Exception err) { MathNode.Log(TraceLogClass.MainForm, err); } // XmlNode ndPos = node.SelectSingleNode(XML_Position); if (ndPos != null) { if (XmlSerialization.ReadValueFromChildNode(ndPos, XML_RelativePosition, out v)) { RelativePosition.Location = (Point)v; nd = ndPos.SelectSingleNode(XML_RelativePosition); RelativePosition.IsXto0 = XmlSerialization.GetAttributeBool(nd, "xTo0", true); RelativePosition.IsYto0 = XmlSerialization.GetAttributeBool(nd, "yTo0", true); } } // _outPortList = new List <EventPortOut>(); XmlNodeList nds = node.SelectNodes(string.Format(System.Globalization.CultureInfo.InvariantCulture, "{0}/{1}", XML_OutPorts, XmlTags.XML_Item)); foreach (XmlNode n in nds) { Type t = XmlUtil.GetLibTypeAttribute(n); EventPortOut po = (EventPortOut)Activator.CreateInstance(t, this); po.Event = this.Event; po.OnReadFromXmlNode(reader, n); _outPortList.Add(po); } nds = node.SelectNodes(string.Format(System.Globalization.CultureInfo.InvariantCulture, "{0}/{1}", XML_InPorts, XmlTags.XML_Item)); if (nds != null && nds.Count > 0) { _inPortList = new List <EventPortIn>(); foreach (XmlNode n in nds) { Type t = XmlUtil.GetLibTypeAttribute(n); EventPortIn po = (EventPortIn)Activator.CreateInstance(t, this); po.Event = this.Event; po.OnReadFromXmlNode(reader, n); _inPortList.Add(po); } } }