Exemplo n.º 1
0
        private static EventImage ToEventImage(XmlNode xmlNode)
        {
            EventImage eventImage = null;

            if (xmlNode != null)
            {
                XmlNode heightXmlNode    = xmlNode.SelectSingleNode("height");
                XmlNode transformXmlNode = xmlNode.SelectSingleNode("transformation_id");
                XmlNode urlXmlNode       = xmlNode.SelectSingleNode("url");
                XmlNode widthXmlNode     = xmlNode.SelectSingleNode("width");

                int height = heightXmlNode.AsInt32();
                EventFindaImageFormat transformationID = EventFindaImageFormat.None;

                Enum.TryParse(transformXmlNode.InnerText, out transformationID);

                string url   = urlXmlNode.AsString();
                int    width = widthXmlNode.AsInt32();

                eventImage = new EventImage
                             (
                    height,
                    transformationID,
                    url,
                    width
                             );
            }

            return(eventImage);
        }
Exemplo n.º 2
0
 /// <summary>
 /// Creates an instance of ImageModel using the values provided.
 /// </summary>
 /// <param name="height">The height of the image.</param>
 /// <param name="transformationID">An EventFinder image tranformation type.</param>
 /// <param name="url">The URL of the image.</param>
 /// <param name="width">The width of the image.</param>
 public ImageModel(int height, EventFindaImageFormat transformationID, string url, int width)
 {
     _height           = height;
     _transformationID = transformationID;
     _url   = url;
     _width = width;
 }