Skip to content

Code Quality: Use LoadIconWithoutOverlayAsync for Quick Access Widget #14536

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jan 23, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 6 additions & 10 deletions src/Files.App/UserControls/Widgets/QuickAccessWidget.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -77,14 +77,10 @@ public FolderCardItem(LocationItem item, string text, bool isPinned)

public async Task LoadCardThumbnailAsync()
{
if (thumbnailData is null || thumbnailData.Length == 0)
{
thumbnailData = await FileThumbnailHelper.LoadIconFromPathAsync(Path, Convert.ToUInt32(Constants.DefaultIconSizes.Jumbo), Windows.Storage.FileProperties.ThumbnailMode.SingleItem, Windows.Storage.FileProperties.ThumbnailOptions.ResizeThumbnail);
}
thumbnailData = await FileThumbnailHelper.LoadIconWithoutOverlayAsync(Path, Constants.DefaultIconSizes.Jumbo, true, true);

if (thumbnailData is not null && thumbnailData.Length > 0)
{
Thumbnail = await MainWindow.Instance.DispatcherQueue.EnqueueOrInvokeAsync(() => thumbnailData.ToBitmapAsync(Constants.DefaultIconSizes.Jumbo));
}
Thumbnail = await MainWindow.Instance.DispatcherQueue.EnqueueOrInvokeAsync(() => thumbnailData.ToBitmapAsync(), Microsoft.UI.Dispatching.DispatcherQueuePriority.Low);
}
}

Expand Down Expand Up @@ -149,7 +145,7 @@ public QuickAccessWidget()
public override List<ContextMenuFlyoutItemViewModel> GetItemMenuItems(WidgetCardItem item, bool isPinned, bool isFolder = false)
{
return new List<ContextMenuFlyoutItemViewModel>()
{
{
new ContextMenuFlyoutItemViewModel()
{
Text = "OpenInNewTab".GetLocalizedResource(),
Expand Down Expand Up @@ -337,7 +333,7 @@ private static async void ItemsAdded_CollectionChanged(object? sender, NotifyCol
}

private void MenuFlyout_Opening(object sender)
{
{
var pinToFavoritesItem = (sender as MenuFlyout)?.Items.SingleOrDefault(x => x.Name == "PinToFavorites");
if (pinToFavoritesItem is not null)
pinToFavoritesItem.Visibility = (pinToFavoritesItem.DataContext as FolderCardItem)?.IsPinned ?? false ? Visibility.Collapsed : Visibility.Visible;
Expand Down Expand Up @@ -432,7 +428,7 @@ public Task RefreshWidgetAsync()
return Task.CompletedTask;
}

public void Dispose()
public void Dispose()
{
}
}
Expand Down