private void AddMenuItemsToMenuTree(IDropInfo dropInfo, List <MenuTreeNodeViewModel> SourceMenuItems, MenuTreeNodeViewModel TargetMenuItem, ObservableCollection <MenuTreeNodeViewModel> Targets) { foreach (var SourceItem in SourceMenuItems) { foreach (var Node in RegistedMenuTreeNodes) { RemoveMenuNodeReclusive(Node, SourceItem); } RegistedMenuTreeNodes.Remove(SourceItem); if (TargetMenuItem != null) { if (!TargetMenuItem.HasExecutableNode) { TargetMenuItem.Children.Add(SourceItem); } } else { RegistedMenuTreeNodes.Add(SourceItem); } } }
private void AddCommandItemsToMenuTree(IDropInfo dropInfo, List <LauncherCommandInfoViewModel> SourceCommandItems, MenuTreeNodeViewModel TargetMenuItem, ObservableCollection <MenuTreeNodeViewModel> Targets) { if (TargetMenuItem != null) { if (!TargetMenuItem.HasExecutableNode) { foreach (var SourceItem in SourceCommandItems) { TargetMenuItem.Children.Add(new MenuTreeNodeViewModel( new MenuTreeNode() { Name = SourceItem.Name, IsVisible = true, Type = MenuType.Menu, CommandInfoID = SourceItem.CommandInfo.UID, Children = new ObservableCollection <MenuTreeNode>() })); } } } else { foreach (var SourceItem in SourceCommandItems) { RegistedMenuTreeNodes.Add(new MenuTreeNodeViewModel( new MenuTreeNode() { Name = SourceItem.Name, IsVisible = true, Type = MenuType.Menu, CommandInfoID = SourceItem.CommandInfo.UID, Children = new ObservableCollection <MenuTreeNode>() })); } } }