Skip to content

Commit 947c00b

Browse files
authored
Load file icons from storagefile if fulltrustprocess fails (#2637)
1 parent d0491a1 commit 947c00b

File tree

1 file changed

+13
-0
lines changed

1 file changed

+13
-0
lines changed

Files/View Models/ItemViewModel.cs

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -644,6 +644,19 @@ public async void LoadExtendedItemProperties(ListedItem item, uint thumbnailSize
644644
StorageFile matchingStorageItem = await GetFileFromPathAsync(item.ItemPath);
645645
if (matchingStorageItem != null)
646646
{
647+
if (!matchingItem.LoadFileIcon) // Loading icon from fulltrust process failed
648+
{
649+
using (var Thumbnail = await matchingStorageItem.GetThumbnailAsync(ThumbnailMode.SingleItem, thumbnailSize, ThumbnailOptions.UseCurrentScale))
650+
{
651+
if (Thumbnail != null)
652+
{
653+
matchingItem.FileImage = new BitmapImage();
654+
await matchingItem.FileImage.SetSourceAsync(Thumbnail);
655+
matchingItem.LoadUnknownTypeGlyph = false;
656+
matchingItem.LoadFileIcon = true;
657+
}
658+
}
659+
}
647660
matchingItem.FolderRelativeId = matchingStorageItem.FolderRelativeId;
648661
matchingItem.ItemType = matchingStorageItem.DisplayType;
649662
var syncStatus = await CheckCloudDriveSyncStatusAsync(matchingStorageItem);

0 commit comments

Comments
 (0)