Skip to content
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

Fix: Fixed context menu hang in recent files and other widgets #11301

Merged
merged 2 commits into from
Feb 14, 2023
Merged
Show file tree
Hide file tree
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
4 changes: 2 additions & 2 deletions src/Files.App/UserControls/Widgets/HomePageWidget.cs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ public abstract class HomePageWidget : UserControl

public abstract List<ContextMenuFlyoutItemViewModel> GetItemMenuItems(WidgetCardItem item, bool isPinned);

public async void Button_RightTapped(object sender, RightTappedRoutedEventArgs e)
public void Button_RightTapped(object sender, RightTappedRoutedEventArgs e)
{
var itemContextMenuFlyout = new CommandBarFlyout { Placement = FlyoutPlacementMode.Full };
if (sender is not Button widgetCardItem || widgetCardItem.DataContext is not WidgetCardItem item)
Expand All @@ -60,7 +60,7 @@ public async void Button_RightTapped(object sender, RightTappedRoutedEventArgs e
secondaryElements.ForEach(i => itemContextMenuFlyout.SecondaryCommands.Add(i));
itemContextMenuFlyout.ShowAt(widgetCardItem, new FlyoutShowOptions { Position = e.GetPosition(widgetCardItem) });

await ShellContextmenuHelper.LoadShellMenuItems(item.Path, itemContextMenuFlyout);
_ = ShellContextmenuHelper.LoadShellMenuItems(item.Path, itemContextMenuFlyout);

e.Handled = true;
}
Expand Down
4 changes: 2 additions & 2 deletions src/Files.App/UserControls/Widgets/RecentFilesWidget.xaml.cs
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ public RecentFilesWidget()
OpenFileLocationCommand = new RelayCommand<RecentItem>(OpenFileLocation);
}

private async void Grid_RightTapped(object sender, RightTappedRoutedEventArgs e)
private void Grid_RightTapped(object sender, RightTappedRoutedEventArgs e)
{
var itemContextMenuFlyout = new CommandBarFlyout { Placement = FlyoutPlacementMode.Full };
if (sender is not Grid recentItemsGrid || recentItemsGrid.DataContext is not RecentItem item)
Expand All @@ -122,7 +122,7 @@ private async void Grid_RightTapped(object sender, RightTappedRoutedEventArgs e)
secondaryElements.ForEach(i => itemContextMenuFlyout.SecondaryCommands.Add(i));
itemContextMenuFlyout.ShowAt(recentItemsGrid, new FlyoutShowOptions { Position = e.GetPosition(recentItemsGrid) });

await ShellContextmenuHelper.LoadShellMenuItems(item.Path, itemContextMenuFlyout);
_ = ShellContextmenuHelper.LoadShellMenuItems(item.Path, itemContextMenuFlyout);

e.Handled = true;
}
Expand Down