Ejemplo n.º 1
0
        private IEnumerable<object> MakeItemContent(CollectionItem item, int id)
        {
            yield return new XAttribute("Id", id);
            yield return new XAttribute("Img", "#" + id.ToString());

            if (!string.IsNullOrEmpty(item.Name))
            {
                yield return new XAttribute("Name", item.Name);
            }

            if (!string.IsNullOrEmpty(item.Url))
            {
                yield return new XAttribute("Href", item.Url);
            }

            if ((null != item.FacetValues) && (item.FacetValues.Count > 0))
            {
                //Note, Pivot does not accept an empty Facets element under Item.
                yield return new XStreamingElement(Xmlns + "Facets", MakeItemFacets(item.FacetValues));
            }
        }
Ejemplo n.º 2
0
        private IEnumerable<object> MakeItemContent(CollectionItem item, int id)
        {
            yield return new XAttribute("Id", id);
            yield return new XAttribute("N", id);
            yield return new XAttribute("IsPath", 1);

            string source = string.Empty;
            if ((null != item.ImageProvider) && (null != item.ImageProvider.DziPath))
            {
                source = item.ImageProvider.DziPath;
            }
            else if (IsAutoGenerateDzi)
            {
                //Only provide an auto-DZI if the image is larger than a collection tile
                if (null != item.ImageProvider)
                {
                    Size size = item.ImageProvider.Size;
                    if ((size.Width > this.TileDimension) || (size.Height > this.TileDimension))
                    {
                        source = DziSerializer.MakeDziPath(m_collection.CollectionKey, id);
                    }
                }
            }
            yield return new XAttribute("Source", source);

            if (null != item.ImageProvider)
            {
                Size size = item.ImageProvider.Size;
                yield return new XStreamingElement(Xmlns + "Size",
                    new XAttribute("Width", size.Width), new XAttribute("Height", size.Height));
            }
        }