Exemple #1
0
            private static void Add(int treeDepth, List <FolderItem> items, NamedMenuItem toAdd)
            {
                var currentTreeItem = toAdd.Location.Folders.Skip(treeDepth).FirstOrDefault();

                var contained = (from a in items where a.Name == currentTreeItem select a).FirstOrDefault();

                //If there is no contained item, add the current tree as far as it goes, then add the item to the end of the list.
                if (contained == null || currentTreeItem == null)
                {
                    RecursivePerformAdd(treeDepth, items, toAdd);
                }
                else
                {
                    Add(treeDepth + 1, contained.Children, toAdd);
                }
            }
Exemple #2
0
            private static void RecursivePerformAdd(int treeDepth, List <FolderItem> items, NamedMenuItem toAdd)
            {
                IEnumerable <string> tree = toAdd.Location.Folders.Skip(treeDepth);

                if (tree.Any())
                {
                    var item = new MidFolderItem(tree.First());
                    items.Add(item);
                    RecursivePerformAdd(treeDepth + 1, item.Children, toAdd);
                }
                else
                {
                    items.Add(new EndFolderItem(toAdd));
                }
            }
Exemple #3
0
 public void AddMenuItem(NamedMenuItem item)
 {
     collection.Add(item);
 }
Exemple #4
0
 public void Add(NamedMenuItem item)
 {
     Add(0, list, item);
 }
Exemple #5
0
 public EndFolderItem(NamedMenuItem item)
 {
     this.Item = item;
 }