Пример #1
0
        private void SetSelectedItem(RepositoryModelItem item)
        {
            this.SelectedItem = item;
            var handler = this.ItemSelected;

            if (handler != null)
            {
                handler(this, EventArgs.Empty);
            }
        }
        private static TreeNode CreateNode(RepositoryModelItem item)
        {
            var node = new TreeNode();

            node.Name       = item.Name;
            node.Text       = item.Name;
            node.Tag        = item;
            node.ImageIndex = node.SelectedImageIndex = item.ImageIndex;
            if (item.IsFolder)
            {
                node.Nodes.Add(new DummyNode());
            }
            return(node);
        }
 public System.Collections.IEnumerable GetChildren(RepositoryModelItem item)
 {
     if (item == null)
     {
         var list = _resSvc.GetRepositoryResources(StringConstants.RootIdentifier, 0);
         return(GetSorted(list));
     }
     else
     {
         if (item.HasChildren)
         {
             var list = _resSvc.GetRepositoryResources(item.ResourceId, _bFoldersOnly ? ResourceTypes.Folder.ToString() : "", 1, true); //NOXLATE
             return(GetSorted(list));
         }
         else
         {
             return(new RepositoryModelItem[0]);
         }
     }
 }
        private void UpdateNode(TreeNode nodeToUpdate)
        {
            RepositoryModelItem item = (RepositoryModelItem)nodeToUpdate.Tag;

            if (IsNodeNotPopulated(nodeToUpdate))
            {
                nodeToUpdate.Nodes.Clear();
            }

            if (item.HasChildren && nodeToUpdate.Nodes.Count == 0)
            {
                StartUpdate();
                foreach (RepositoryModelItem child in GetChildren(item))
                {
                    var node = CreateNode(child);
                    nodeToUpdate.Nodes.Add(node);
                }
                EndUpdate();
            }
        }
Пример #5
0
 private void SetSelectedItem(RepositoryModelItem item)
 {
     this.SelectedItem = item;
     var handler = this.ItemSelected;
     if (handler != null)
         handler(this, EventArgs.Empty);
 }
Пример #6
0
 private static TreeNode CreateNode(RepositoryModelItem item)
 {
     var node = new TreeNode();
     node.Name = item.Name;
     node.Text = item.Name;
     node.Tag = item;
     node.ImageIndex = node.SelectedImageIndex = item.ImageIndex;
     if (item.IsFolder)
         node.Nodes.Add(new DummyNode());
     return node;
 }
Пример #7
0
 public System.Collections.IEnumerable GetChildren(RepositoryModelItem item)
 {
     if (item == null)
     {
         var list = _resSvc.GetRepositoryResources(StringConstants.RootIdentifier, 0);
         return GetSorted(list);
     }
     else
     {
         if (item.HasChildren)
         {
             var list = _resSvc.GetRepositoryResources(item.ResourceId, _bFoldersOnly ? ResourceTypes.Folder.ToString() : "", 1, true); //NOXLATE
             return GetSorted(list);
         }
         else
         {
             return new RepositoryModelItem[0];
         }
     }
 }
 private void SetSelectedItem(RepositoryModelItem item)
 {
     this.SelectedItem = item;
     this.ItemSelected?.Invoke(this, EventArgs.Empty);
 }
        private void OnNodeAfterSelect(object sender, TreeViewEventArgs e)
        {
            RepositoryModelItem item = (RepositoryModelItem)e.Node.Tag;

            SetSelectedItem(item);
        }