/// <summary> /// Gets the object collection. /// </summary> /// <param name="xmlData"> /// The XML data. /// </param> /// <returns> /// </returns> private async Task <HLinkMediaModelCollection> GetObjectCollection(XElement xmlData) { HLinkMediaModelCollection t = new HLinkMediaModelCollection(); var theORElement = from _ORElementEl in xmlData.Elements(ns + "objref") select _ORElementEl; if (theORElement.Any()) { // load media object references foreach (XElement theLoadORElement in theORElement) { // save the MediaObject reference HLinkMediaModel t2 = new HLinkMediaModel { HLinkKey = GetAttribute(theLoadORElement.Attribute("hlink")), }; // Get region XElement regionDetails = theLoadORElement.Element(ns + "region"); if (regionDetails != null) { HLinkLoadImageModel t3 = new HLinkLoadImageModel { HLinkKey = t2.HLinkKey, HomeImageType = CommonEnums.HomeImageType.ThumbNail, GCorner1X = (int)regionDetails.Attribute("corner1_x"), GCorner1Y = (int)regionDetails.Attribute("corner1_y"), GCorner2X = (int)regionDetails.Attribute("corner2_x"), GCorner2Y = (int)regionDetails.Attribute("corner2_y"), }; t2 = await CreateClippedMediaModel(t3).ConfigureAwait(false); } // Get remaining fields t2.GAttributeRefCollection = GetAttributeCollection(theLoadORElement); t2.GCitationRefCollection = GetCitationCollection(theLoadORElement); t2.GNoteRefCollection = GetNoteCollection(theLoadORElement); // TODO !ELEMENT objref (region?, attribute*, citationref*, noteref*)> // !ATTLIST objref hlink IDREF #REQUIRED priv (0|1) #IMPLIED t.Add(t2); } } // Return sorted by the default text t.SortAndSetFirst(); return(t); }
/// <summary> /// Gets the object collection. /// </summary> /// <param name="xmlData"> /// The XML data. /// </param> /// <returns> /// </returns> private async Task <HLinkMediaModelCollection> GetObjectCollection(XElement xmlData) { HLinkMediaModelCollection t = new HLinkMediaModelCollection { Title = "Media Collection" }; IEnumerable <XElement> theORElement = from _ORElementEl in xmlData.Elements(ns + "objref") select _ORElementEl; if (theORElement.Any()) { // load media object references foreach (XElement theLoadORElement in theORElement) { // save the MediaObject reference HLinkMediaModel outHLMediaModel = new HLinkMediaModel { HLinkKey = GetHLinkKey(theLoadORElement), Priv = GetPrivateObject(theLoadORElement), }; if (outHLMediaModel.HLinkKey.Value == "_ea97612787a7a61ff4c3177b8b0") { } // Get region XElement regionDetails = theLoadORElement.Element(ns + "region"); if (regionDetails != null) { outHLMediaModel.HLinkGlyphItem.ImageType = CommonEnums.HLinkGlyphType.Image; outHLMediaModel.GCorner1X = (int)regionDetails.Attribute("corner1_x"); outHLMediaModel.GCorner1Y = (int)regionDetails.Attribute("corner1_y"); outHLMediaModel.GCorner2X = (int)regionDetails.Attribute("corner2_x"); outHLMediaModel.GCorner2Y = (int)regionDetails.Attribute("corner2_y"); outHLMediaModel = await CreateClippedMediaModel(outHLMediaModel).ConfigureAwait(false); } // Get remaining fields outHLMediaModel.GAttributeRefCollection = GetAttributeCollection(theLoadORElement); outHLMediaModel.GCitationRefCollection = GetCitationCollection(theLoadORElement); outHLMediaModel.GNoteRefCollection = GetNoteCollection(theLoadORElement); t.Add(outHLMediaModel); } } return(t); }