예제 #1
0
        /// <summary>
        /// Generates content item visual and makes a picture of it
        /// </summary>
        /// <param name="_title">String containing title of the content item</param>
        /// <param name="_url">Uri of the media element of the content item</param>
        /// <param name="_desc">String contanting the description of the content item</param>
        /// <param name="initialSize">Initial size of the content item</param>
        /// <returns>BitmapSource with image of the content item of the specified size</returns>
        internal static BitmapSource[] MakeThumbs(ContentItem ciData, Size[] sizes, Size initialSize)
        {
            if (ciData.thumbnail == null)
            {
                ciData.thumbnail = Thumbs.GetMediaThumbnail(ciData);
            }

            if (ciData.thumbnail == null)
            {
                // cannot create thumbnail
                return(null);
            }

            ContentItemControl element = new ContentItemControl();

            element.Height = initialSize.Height;
            element.Width  = initialSize.Width;
            element.Data   = ciData;
            element.Measure(initialSize);
            element.Arrange(new Rect(initialSize));

            BitmapSource bmpSource = CreateBitmapSourceFromVisual(initialSize, element);

            return(CreateResizedBitmapSources(bmpSource, sizes));
        }
예제 #2
0
        /// <summary>
        /// Generates content item visual and makes a picture of it
        /// </summary>
        /// <param name="_title">String containing title of the content item</param>
        /// <param name="_url">Uri of the media element of the content item</param>
        /// <param name="_desc">String contanting the description of the content item</param>
        /// <param name="initialSize">Initial size of the content item</param>
        /// <returns>BitmapSource with image of the content item of the specified size</returns>
        internal static BitmapSource[] MakeThumbs(ContentItem ciData, Size[] sizes, Size initialSize)
        {
            if (ciData.thumbnail == null)
            {
                ciData.thumbnail = Thumbs.GetMediaThumbnail(ciData);
            }

            if (ciData.thumbnail == null)
            {
                // cannot create thumbnail
                return null;
            }

            ContentItemControl element = new ContentItemControl();
            element.Height = initialSize.Height;
            element.Width = initialSize.Width;
            element.Data = ciData;
            element.Measure(initialSize);
            element.Arrange(new Rect(initialSize));

            BitmapSource bmpSource = CreateBitmapSourceFromVisual(initialSize, element);

            return CreateResizedBitmapSources(bmpSource, sizes);
        }