Skip to content

Commit

Permalink
Improve WarmUpQueryContextMenuAsync()
Browse files Browse the repository at this point in the history
  • Loading branch information
hishitetsu committed Apr 27, 2023
1 parent 4cc1938 commit b179943
Showing 1 changed file with 1 addition and 9 deletions.
10 changes: 1 addition & 9 deletions src/Files.App/Shell/ContextMenu.cs
Original file line number Diff line number Diff line change
Expand Up @@ -165,15 +165,7 @@ public async Task InvokeItem(int itemID)

public static async Task WarmUpQueryContextMenuAsync()
{
var thread = new ThreadWithMessageQueue();
await thread.PostMethod(() =>
{
// Create a dummy context menu for warming up
var shellItem = ShellFolderExtensions.GetShellItemFromPathOrPidl("C:\\");
Shell32.IContextMenu menu = shellItem.Parent.GetChildrenUIObjects<Shell32.IContextMenu>(default, shellItem);
menu.QueryContextMenu(User32.CreatePopupMenu(), 0, 1, 0x7FFF, Shell32.CMF.CMF_NORMAL);
});
thread.Dispose();
using var cMenu = await GetContextMenuForFiles(new string[] { "C:\\" }, Shell32.CMF.CMF_NORMAL);
}

#endregion FactoryMethods
Expand Down

0 comments on commit b179943

Please sign in to comment.