diff --git a/FoliCon/Models/Data/DArtImageList.cs b/FoliCon/Models/Data/DArtImageList.cs index 27746ed..4473e4a 100644 --- a/FoliCon/Models/Data/DArtImageList.cs +++ b/FoliCon/Models/Data/DArtImageList.cs @@ -3,21 +3,21 @@ public class DArtImageList : BindableBase { private string _url; - private BitmapSource _image; + private string _thumbnailUrl; private string _deviationId; - public DArtImageList(string url, BitmapSource bmp) + public DArtImageList(string url, string thumbnailUrl) { Url = url ?? throw new ArgumentNullException(nameof(url)); - Image = bmp ?? throw new ArgumentNullException(nameof(bmp)); + ThumbnailUrl = thumbnailUrl ?? throw new ArgumentNullException(nameof(thumbnailUrl)); } - public DArtImageList(string url, BitmapSource bmp, string deviationId) : this(url, bmp) + public DArtImageList(string url, string thumbnailUrl, string deviationId) : this(url, thumbnailUrl) { DeviationId = deviationId ?? throw new ArgumentNullException(nameof(deviationId)); } public string Url { get => _url; set => SetProperty(ref _url, value); } - public BitmapSource Image { get => _image; set => SetProperty(ref _image, value); } + public string ThumbnailUrl { get => _thumbnailUrl; set => SetProperty(ref _thumbnailUrl, value); } public string DeviationId { get => _deviationId; set => SetProperty(ref _deviationId, value); } } \ No newline at end of file diff --git a/FoliCon/ViewModels/PosterPickerViewModel.cs b/FoliCon/ViewModels/PosterPickerViewModel.cs index a093c24..7cb0b02 100644 --- a/FoliCon/ViewModels/PosterPickerViewModel.cs +++ b/FoliCon/ViewModels/PosterPickerViewModel.cs @@ -197,9 +197,7 @@ private async void LoadImages(ImagesWithId images) continue; } - var bm = await response.GetBitmap(); - ImageUrl.Add(new DArtImageList(qualityPath, ImageUtils.LoadBitmap(bm))); - bm.Dispose(); + ImageUrl.Add(new DArtImageList(qualityPath, posterPath)); } if (!_stopSearch) continue; @@ -240,9 +238,7 @@ private async void LoadImages(Artwork[] images) .Property("Response", response).Log(); continue; } - var bm = await response.GetBitmap(); - ImageUrl.Add(new DArtImageList(image.ImageId, ImageUtils.LoadBitmap(bm))); - bm.Dispose(); + ImageUrl.Add(new DArtImageList(posterPath, posterPath, image.ImageId)); } if (!_stopSearch) continue; @@ -268,8 +264,8 @@ private void PickMethod(DArtImageList pickedImage) _resultList[PickedIndex].SetInitialPoster(); if (Result.MediaType == MediaTypes.Game) { - result.Cover.Value.ImageId = link; - _resultList[PickedIndex].Poster = "https://" + ImageHelper.GetImageUrl(link, ImageSize.HD720)[2..]; + result.Cover.Value.ImageId = pickedImage.DeviationId; + _resultList[PickedIndex].Poster = "https://" + ImageHelper.GetImageUrl(pickedImage.DeviationId, ImageSize.HD720)[2..]; Logger.Trace("Poster Path: {PosterPath}", _resultList[PickedIndex].Poster); } else diff --git a/FoliCon/ViewModels/ProSearchResultViewModel.cs b/FoliCon/ViewModels/ProSearchResultViewModel.cs index 71970a4..e00b44d 100644 --- a/FoliCon/ViewModels/ProSearchResultViewModel.cs +++ b/FoliCon/ViewModels/ProSearchResultViewModel.cs @@ -150,17 +150,8 @@ private async Task Search(string query, int offset = 0) Logger.Warn("Poster {Index} is not downloadable", item.Value.Url); continue; } - var response = await Services.HttpC.GetAsync(item.Value.Thumbs[0].Src); - if (response.StatusCode != HttpStatusCode.OK) - { - Logger.ForErrorEvent().Message("Could not download image {Image}", item.Value.Thumbs[0].Src) - .Property("Response", response).Log(); - continue; - } - using (var bm = await response.GetBitmap()) - { - ImageUrl.Add(new DArtImageList(item.Value.Content.Src, ImageUtils.LoadBitmap(bm), item.Value.Deviationid)); - } + + ImageUrl.Add(new DArtImageList(item.Value.Content.Src, item.Value.Thumbs[0].Src, item.Value.Deviationid)); if (_stopSearch) { Logger.Debug("Search Stopped by user at {Index}", Index); diff --git a/FoliCon/Views/ProSearchResult.xaml b/FoliCon/Views/ProSearchResult.xaml index c85bf8a..6398459 100644 --- a/FoliCon/Views/ProSearchResult.xaml +++ b/FoliCon/Views/ProSearchResult.xaml @@ -75,7 +75,7 @@ -