public static UmlAssociationShapeViewModel ReadDocument(XmlReader reader, IShapeParent parent, UmlTypes umlType) { UmlAssociationShapeViewModel ret = UmlElementDataDef.CreateShape(umlType, new System.Windows.Point(UmlTypeToStringConverter.DefaultX, UmlTypeToStringConverter.DefaultY), parent) as UmlAssociationShapeViewModel; reader.ReadToNextSibling(ret.UmlDataTypeString); while (reader.MoveToNextAttribute()) { if (ret.ReadAttributes(reader.Name, reader.Value) == false) { if (reader.Name.Trim().Length > 0 && reader.Name != XmlComment) { throw new ArgumentException("XML node:'" + reader.Name + "' as child of '" + ret.UmlDataTypeString + "' is not supported."); } } } // Read child elements of this XML node while (reader.Read()) { if (reader.NodeType == XmlNodeType.Element) { switch (reader.Name) { case "Anchor": AnchorViewModel p = new AnchorViewModel(parent) { Left = 0, Top = 0 }; AnchorViewModel.ReadDocument(reader.ReadSubtree(), parent, p); ret.Add(p); break; default: throw new NotImplementedException(string.Format("'{0}' is not a valid sub-node of {1}", reader.Name, ret.XElementName)); } } } return(ret); }
internal static AnchorViewModel ReadDocument(XmlReader reader, IShapeParent parent, AnchorViewModel anchor) { reader.ReadToNextSibling(anchor.XElementName); while (reader.MoveToNextAttribute()) { if (anchor.ReadAttributes(reader.Name, reader.Value) == false) { throw new NotImplementedException(string.Format("The attribute '{0}' is not supported in '{1}'.", reader.Name, anchor.XElementName)); } } return(anchor); }