Пример #1
0
        /*public void AddToTree(TreeViewItem item, string package)
         * {
         *  foreach (KeyValuePair<string, FolderStruct> entry in this.folders)
         *  {
         *      if (!entry.Value.ContainsAnyBundleEntries() && !entry.Value.ContainsAnyBundleEntries(package))
         *          continue;
         *
         *      TreeViewItem treeItem = new TreeViewItem()
         *      {
         *          Header = entry.Key,
         *          Tag = entry.Value,
         *          HeaderTemplate = item.HeaderTemplate
         *      };
         *      item.Items.Add(treeItem);
         *      entry.Value.AddToTree(treeItem);
         *  }
         * }*/

        /*public void AddToBreadcrumb(BreadcrumbItem brdItem)
         * {
         *  foreach (KeyValuePair<string, FolderStruct> entry in this.folders)
         *  {
         *      if (!entry.Value.ContainsAnyBundleEntries())
         *          continue;
         *
         *      BreadcrumbItem subBrdItem = new BreadcrumbItem()
         *      {
         *          Header = entry.Key,
         *          Tag = entry.Value,
         *          Image = (ImageSource)App.Current.FindResource("Icon_FolderClosed")
         *      };
         *      brdItem.Items.Add(subBrdItem);
         *      entry.Value.AddToBreadcrumb(subBrdItem);
         *  }
         * }*/

        public bool ContainsAnyBundleEntries(Idstring package = null)
        {
            foreach (KeyValuePair <string, IChild> entry in this._children)
            {
                if (entry.Value is IParent)
                {
                    IParent _entry = entry.Value as IParent;
                    if (_entry.ContainsAnyBundleEntries(package))
                    {
                        return(true);
                    }
                }
                else if (entry.Value is FileEntry)
                {
                    FileEntry _entry = entry.Value as FileEntry;
                    if (_entry.BundleEntries.Count != 0 && (package != null ? _entry.BundleEntries.FindIndex(ent => ent.Parent.Name.Equals(package)) != -1 : true))
                    {
                        return(true);
                    }
                }
            }

            return(false);
        }
Пример #2
0
        public void AddToTree(TreeItem item, Idstring pck = null)
        {
            foreach (KeyValuePair <string, IChild> entry in this._children)
            {
                if (entry.Value is IParent)
                {
                    IParent _entry = entry.Value as IParent;

                    if (pck != null && !_entry.ContainsAnyBundleEntries(pck))
                    {
                        continue;
                    }

                    TreeItem treeItem = new TreeItem()
                    {
                        Text  = entry.Key,
                        Image = this.Icon,
                        Tag   = entry.Value
                    };
                    item.Children.Add(treeItem);
                    _entry.AddToTree(treeItem, pck);
                }
            }
        }