예제 #1
0
        public async void GetImageAsync(ImageListModel item)
        {
            try
            {
                item.ImageLoadState = EnumLoadState.Loading;
                if (!string.IsNullOrEmpty(item.CacheName))
                {
                    if (!await ImageCache.HasCache(item.CacheName))
                    {
                        var imgStream = await Site.DownloadImage(item.ImageUrl, item.IsCance.Token);

                        if (imgStream != null)
                        {
                            await ImageCache.CreateCache(item.CacheName, imgStream);
                        }
                    }

                    BitmapImage img = await ImageCache.HasCache(item.CacheName) ? await ImageCache.GetImage(item.CacheName) : ImageCache.ErrorImage;

                    if (img == null)
                    {
                        item.Image = ImageCache.ErrorImage;
                    }

                    item.Image          = img;
                    item.ImageLoadState = EnumLoadState.Loaded;
                    item.OnLoaded();
                }
            }
            catch (Exception ex)
            { }
        }
예제 #2
0
        /// <summary>
        /// Renders a photo detail comparison as defined by the grouping filter
        /// </summary>
        /// <param name="f">The grouping/filter</param>
        /// <returns>
        /// the result of the rendering (eg. an <see cref="Image"/>
        /// </returns>
        public object Render(GroupFilter f)
        {
            // max size of any matching tile
            TileSize = f.GetMaxOutputTileSize();

            using (var ic = ImageCache.CreateCache())
            {
                MainWindow.Instance.ScaleProgress("rendering", f.TotalTiles);
                TextHeight = CalcTextHeight() + (2 * Padding);
                var table = RenderGroup(f, f.Input);
                MainWindow.Instance.ClearProgress();
                return(table);
            }
        }