/// <summary> /// Gets the attribute collection. /// </summary> /// <param name="xmlData"> /// The XML data. /// </param> /// <returns> /// </returns> private OCAttributeModelCollection GetAttributeCollection(XElement xmlData) { OCAttributeModelCollection t = new OCAttributeModelCollection(); // Get colour Application.Current.Resources.TryGetValue("CardBackGroundAttribute", out var varCardColour); Color cardColour = (Color)varCardColour; // Run query var theERElement = from orElementEl in xmlData.Elements(ns + "attribute") select orElementEl; if (theERElement.Any()) { // Load attribute object references foreach (XElement theLoadORElement in theERElement) { AttributeModel newAttributeModel = new AttributeModel { Handle = "AttributeCollection", GCitationReferenceCollection = GetCitationCollection(theLoadORElement), GNoteModelReferenceCollection = GetNoteCollection(theLoadORElement), Priv = SetPrivateObject(GetAttribute(theLoadORElement.Attribute("priv"))), GType = GetAttribute(theLoadORElement.Attribute("type")), GValue = GetAttribute(theLoadORElement.Attribute("value")), }; // set the Home image or symbol newAttributeModel.HomeImageHLink.HomeImageType = CommonConstants.HomeImageTypeSymbol; newAttributeModel.HomeImageHLink.HomeSymbol = CommonConstants.IconAttribute; newAttributeModel.HomeImageHLink.HomeSymbolColour = cardColour; t.Add(newAttributeModel); } } // Return sorted by the default text t.Sort(T => T.DeRef.GetDefaultText); return(t); }
/// <summary> /// Gets the attribute collection. /// </summary> /// <param name="xmlData"> /// The XML data. /// </param> /// <returns> /// </returns> private OCAttributeModelCollection GetAttributeCollection(XElement xmlData) { OCAttributeModelCollection t = new OCAttributeModelCollection(); // Run query var theERElement = from orElementEl in xmlData.Elements(ns + "attribute") select orElementEl; if (theERElement.Any()) { // Load attribute object references foreach (XElement theLoadORElement in theERElement) { AttributeModel newAttributeModel = new AttributeModel { Handle = "AttributeCollection", GCitationReferenceCollection = GetCitationCollection(theLoadORElement), GNoteModelReferenceCollection = GetNoteCollection(theLoadORElement), Priv = SetPrivateObject(GetAttribute(theLoadORElement.Attribute("priv"))), GType = GetAttribute(theLoadORElement.Attribute("type")), GValue = GetAttribute(theLoadORElement.Attribute("value")), }; t.Add(newAttributeModel); } } // Return sorted by the default text t.Sort(T => T.DeRef.GetDefaultText); return(t); }