private void ConfigureMenuItems(ShellFolder folder, IntPtr contextMenu, ShellMenuCommandBuilder builder) { int numAdded = 0; ShellNewMenus.Clear(); foreach (var command in builder.Commands) { if (command is ShellNewMenuCommand shellNewCommand) { shellNewCommand.AddSubMenu(folder, numAdded, ref contextMenu); ShellNewMenus.Add(shellNewCommand); } else { Interop.AppendMenu(contextMenu, command.Flags, command.UID, command.Label); } numAdded++; } }
private uint ConfigureMenuItems(bool allFolders, IntPtr contextMenu, ShellMenuCommandBuilder builder) { uint numAdded = 0; foreach (var command in builder.Commands) { if (allFolders || !command.FoldersOnly) { Interop.AppendMenu(contextMenu, command.Flags, command.UID, command.Label); if (command.UID != 0 && command.UID == builder.DefaultItemUID) { Interop.SetMenuDefaultItem(contextMenu, command.UID, 0); } } numAdded++; } return(numAdded); }