From 972823b5947b9bfde8ed67984de12ee75ec0c8e0 Mon Sep 17 00:00:00 2001 From: Yair <39923744+yaira2@users.noreply.github.com> Date: Wed, 31 Jan 2024 17:57:09 -0500 Subject: [PATCH] Update ItemViewModel.cs --- src/Files.App/Data/Models/ItemViewModel.cs | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/Files.App/Data/Models/ItemViewModel.cs b/src/Files.App/Data/Models/ItemViewModel.cs index 9103b44769bb4..e555018f1a7f8 100644 --- a/src/Files.App/Data/Models/ItemViewModel.cs +++ b/src/Files.App/Data/Models/ItemViewModel.cs @@ -946,7 +946,7 @@ private async Task LoadItemThumbnailAsync(ListedItem item, uint thumbnailSize = if (!iconInfo.isIconCached) { - // Display icon while trying to load cached thumbnail + // Assign a placeholder icon while trying to get a cached thumbnail if (iconInfo.IconData is not null) { await dispatcherQueue.EnqueueOrInvokeAsync(async () => @@ -969,8 +969,10 @@ await dispatcherQueue.EnqueueOrInvokeAsync(async () => { await dispatcherQueue.EnqueueOrInvokeAsync(async () => { + // Assign the thumbnail/icon to the listed item item.FileImage = await iconInfo.IconData.ToBitmapAsync(); + // Add the file icon to the DefaultIcons list if (!DefaultIcons.ContainsKey(item.FileExtension.ToLowerInvariant()) && !string.IsNullOrEmpty(item.FileExtension)) { var fileIcon = await FileThumbnailHelper.LoadIconAndOverlayAsync(item.ItemPath, thumbnailSize, false, true); @@ -983,6 +985,7 @@ await dispatcherQueue.EnqueueOrInvokeAsync(async () => if (iconInfo.OverlayData is not null) { + // Assign the icon overlay to the listed item await dispatcherQueue.EnqueueOrInvokeAsync(async () => { item.IconOverlay = await iconInfo.OverlayData.ToBitmapAsync();