Skip to content

Commit

Permalink
Update ItemViewModel.cs
Browse files Browse the repository at this point in the history
  • Loading branch information
yaira2 committed Jan 31, 2024
1 parent 23fce63 commit 972823b
Showing 1 changed file with 4 additions and 1 deletion.
5 changes: 4 additions & 1 deletion src/Files.App/Data/Models/ItemViewModel.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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 () =>
Expand All @@ -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);
Expand All @@ -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();
Expand Down

0 comments on commit 972823b

Please sign in to comment.