private void BuildMenuCommandHierarchy(ICommandEx parentCommand, ICommandSourceParent commandVisual, ShellMenu shellMenu) { if (parentCommand != null) { ICommandSourceParent parentCommandVisual; if (_commandInformations.TryGetValue(parentCommand, out parentCommandVisual)) { parentCommandVisual.AddItem(commandVisual); return; } parentCommandVisual = new ShellMenuItem(parentCommand); parentCommandVisual.AddItem(commandVisual); _commandInformations.Add(parentCommand, parentCommandVisual); parentCommand = parentCommand.MenuCommandParent; BuildMenuCommandHierarchy(parentCommand, parentCommandVisual, shellMenu); } else { shellMenu.AddItem(commandVisual); } }
public MenuManager(ShellMenu applicationMenu) { _shellMenu = applicationMenu; _commandInformations = new Dictionary<ICommandEx, ICommandSourceParent>(); }