示例#1
0
        public override void RequestRootNode()
        {
            // do not call base class here
            // base.RequestRootNode();

            AttachSystemImageList(Helper);
            // setup up root node collection
            switch (RootFolder)
            {
            case Raccoom.Win32.ShellAPI.CSIDL.DESKTOP:
                // create root node <Desktop>
                TreeNodePath desktopNode = CreateTreeNode(Helper.TreeView.Nodes, null, _shell.DesktopItem);
                _rootCollection = desktopNode.Nodes;
                // enable shell objects always to fill desktop level
                bool settingBackup = _showAllShellObjects;
                _showAllShellObjects = true;
                // set setting back to original value
                _showAllShellObjects = settingBackup;
                break;

            case  Raccoom.Win32.ShellAPI.CSIDL.DRIVES:
                this.FillMyComputer(_shell.MyComputerItem, Helper.TreeView.Nodes, Helper);
                break;

            default:
                //
                TreeNodePath rootNode = CreateTreeNode(Helper.TreeView.Nodes, null, _shell.GetSpecialFolderShellItem(RootFolder));
                if (!rootNode.HasDummyNode)
                {
                    rootNode.AddDummyNode();
                }
                _rootCollection = rootNode.Nodes;
                break;
            }
        }
示例#2
0
        private string CreateTree1(SetTree trees, System.Windows.Forms.TreeNodeCollection treeNodeCollection)
        {
            StringBuilder sb = new StringBuilder();

            foreach (var item in treeNodeCollection)
            {
                VTreeNode vt = (VTreeNode)item;
                if (vt.IsSummary)
                {
                    SetTree newTrees = new SetTree();
                    if (trees.items == null)
                    {
                        trees.expanded = false;
                        trees.items    = new List <SetTree>();
                    }
                    trees.items.Add(newTrees);
                    sb.Append(GetSummaryItemStart(newTrees, vt.Parent_ID, vt.Node_ID, System.Net.WebUtility.HtmlEncode(vt.SetName)));
                    sb.Append(CreateTree1(newTrees, ((System.Windows.Forms.TreeNode)vt).Nodes));
                }
                else
                {
                    sb.Append(GetTreeItem(trees, vt.Parent_ID, vt.Node_ID, System.Net.WebUtility.HtmlEncode(vt.SetName), vt.ImageKey, vt.GetAction(), vt.GetActionID(), vt.OnBar));
                }
            }

            return(sb.ToString());
        }
        /// <summary>
        /// Creates a tree node and add it to the <c>TreeNodeCollection</c>.
        /// </summary>
        /// <param name="parentCollection"><c>TreeNodeCollection</c> to which the new node will added.</param>
        /// <param name="parentNode">Parent node for the new created child node.</param>
        /// <param name="text">The text displayed in the label of the tree node.</param>
        /// <param name="path">The path the node represents.</param>
        /// <param name="addDummyNode">True to add + sign, otherwise no + sign appears.</param>
        /// <param name="forceChecked">True to check node in each case, otherwise false to allow normal check against selected paths.</param>
        /// <param name="isSpecialFolder">Specifies if this node is a special folder. Special folders do not request data from the attached data provider.</param>
        /// <returns>The newly created and added node</returns>
        public virtual TreeNodePath CreateTreeNode(System.Windows.Forms.TreeNodeCollection parentCollection, TreeNodePath parentNode, string text, string path, bool addDummyNode, bool forceChecked, bool isSpecialFolder)
        {
            if (parentCollection == null)
            {
                throw new ArgumentNullException("parentCollection");
            }
            //

            /*
             *          if (_treeView.InvokeRequired)
             *          {
             *                  return _treeView.Invoke(new CreateTreeNodeDelegate(CreateTreeNode), new object[] {parentNode, text, path, addDummyNode, forceChecked, isSpecialFolder}) as TreeNodePath;
             *          }*/
            //
            forceChecked = forceChecked || (TreeView.CheckBoxBehaviorMode == CheckBoxBehaviorMode.RecursiveChecked && (parentNode != null && parentNode.Checked));
            //

            TreeNodePath childNode = CreateTreeNode(text, path, addDummyNode, forceChecked, isSpecialFolder);

            if (isSpecialFolder || parentNode == null || parentNode.IsSpecialFolder)
            {
                //Normalize, Cw+
                childNode.ToolTipText = path.Replace('\\', '/');
                if (Directory.Exists(childNode.ToolTipText))
                {
                    childNode.ToolTipText += "/";
                }
                /////
            }

            parentCollection.Add(childNode);
            return(childNode);
        }
 public void InitializeExtractionForTagHierarchy(System.Windows.Forms.TreeNodeCollection nodes,
                                                 bool all, bool r_checked)
 {
     m_extractAllNodes   = nodes;
     m_extractAll        = all;
     m_extractAllChecked = r_checked;
 }
示例#5
0
        private void LoadTreeXML(
            System.Xml.XmlNode xmlInfo,
            System.Windows.Forms.TreeNodeCollection tv)
        {
            System.Windows.Forms.TreeNode tnode;
            System.Windows.Forms.TreeNode tAttr;
            switch (xmlInfo.NodeType)
            {
            case System.Xml.XmlNodeType.Element:
                tnode      = new System.Windows.Forms.TreeNode();
                tnode.Text = "<" + xmlInfo.Name + ">";
                foreach (System.Xml.XmlNode xnode in xmlInfo.ChildNodes)
                {
                    LoadTreeXML(xnode, tnode.Nodes);
                }
                foreach (System.Xml.XmlAttribute xAttr in xmlInfo.Attributes)
                {
                    tAttr      = new System.Windows.Forms.TreeNode();
                    tAttr.Text = "@" + xAttr.Name + " = " + xAttr.Value;
                    tnode.Nodes.Add(tAttr);
                }
                tv.Add(tnode);
                break;

            case System.Xml.XmlNodeType.Attribute:
                break;

            default:
                // just skip it
                break;
            }
        }
 protected override TreeNodePath CreateTreeNode(System.Windows.Forms.TreeNodeCollection parentCollection, TreeNodePath parentNode, string text, string path, bool isFile, bool addDummyNode, bool isSpecialFolder)
 {
     if (isFile && _hideFileExention)
     {
         text = System.IO.Path.GetFileNameWithoutExtension(path);
     }
     return(base.CreateTreeNode(parentCollection, parentNode, text, path, isFile, addDummyNode, isSpecialFolder));
 }
示例#7
0
 public static void AddTreeNode(string str, int cls, System.Windows.Forms.TreeNodeCollection nodes)
 {
     System.Windows.Forms.TreeNode nodeTemp = new System.Windows.Forms.TreeNode();
     nodeTemp.Text               = str;
     nodeTemp.ImageIndex         = cls;
     nodeTemp.SelectedImageIndex = cls;
     nodes.Add(nodeTemp);
 }
示例#8
0
 private System.Windows.Forms.TreeNode getNode(System.Windows.Forms.TreeNodeCollection tnc, string task_code)
 {
     foreach (System.Windows.Forms.TreeNode tn in tnc)
     {
         if (tn.Tag.ToString() == task_code)
         {
             return(tn);
         }
     }
     return(null);
 }
示例#9
0
        /// <summary>
        /// Get all nodes recursively
        /// </summary>
        public static List <System.Windows.Forms.TreeNode> GetAllNodes(this System.Windows.Forms.TreeNodeCollection l)
        {
            var retval = new List <System.Windows.Forms.TreeNode>();

            foreach (System.Windows.Forms.TreeNode o in l)
            {
                retval.Add(o);
                retval.AddRange(GetAllNodes(o.Nodes));
            }
            return(retval);
        }
示例#10
0
 private void updateSelectedFates(System.Windows.Forms.TreeNodeCollection nodes)
 {
     foreach (System.Windows.Forms.TreeNode node in nodes)
     {
         if (node.Checked)
         {
             telegramSelectedFates.Push((string)node.Tag);
         }
         updateSelectedFates(node.Nodes);
     }
 }
        /// <summary>
        /// Create Tree
        /// </summary>
        /// <param name="treeNodeCollection"></param>
        /// <param name="baseUrl"></param>
        /// <returns></returns>
        private string CreateTree(System.Windows.Forms.TreeNodeCollection treeNodeCollection, string baseUrl, string windowNo = "")
        {
            StringBuilder sb = new StringBuilder();

            if (_onDemandTree)
            {
                foreach (var item in treeNodeCollection)
                {
                    VTreeNode vt = (VTreeNode)item;
                    if (vt.IsSummary)
                    {
                        if (vt.IsSummary)
                        {
                            if (((System.Windows.Forms.TreeNode)vt).Nodes.Count > 0)
                            {
                                sb.Append(GetSummaryItemStart(vt.Node_ID, System.Net.WebUtility.HtmlEncode(vt.SetName) + " (" + ((System.Windows.Forms.TreeNode)vt).Nodes.Count + ")", windowNo));
                            }
                            else
                            {
                                sb.Append(GetSummaryItemStart(vt.Node_ID, System.Net.WebUtility.HtmlEncode(vt.SetName), windowNo));
                            }
                            sb.Append(CreateTree(((System.Windows.Forms.TreeNode)vt).Nodes, baseUrl, windowNo));
                            sb.Append(GetSummaryItemEnd());
                        }
                        else
                        {
                            sb.Append(GetTreeItem(vt.Node_ID, System.Net.WebUtility.HtmlEncode(vt.SetName), vt.ImageKey, vt.GetAction(), vt.GetActionID(), baseUrl, windowNo, vt.OnBar));
                        }
                    }
                }
            }
            else
            {
                foreach (var item in treeNodeCollection)
                {
                    VTreeNode vt = (VTreeNode)item;
                    if (vt.IsSummary)
                    {
                        sb.Append(GetSummaryItemStart(vt.Node_ID, System.Net.WebUtility.HtmlEncode(vt.SetName), windowNo));
                        sb.Append(CreateTree(((System.Windows.Forms.TreeNode)vt).Nodes, baseUrl, windowNo));
                        sb.Append(GetSummaryItemEnd());
                    }
                    else
                    {
                        sb.Append(GetTreeItem(vt.Node_ID, System.Net.WebUtility.HtmlEncode(vt.SetName), vt.ImageKey, vt.GetAction(), vt.GetActionID(), baseUrl, windowNo, vt.OnBar));
                    }
                }
            }
            return(sb.ToString());
        }
        /// <summary>
        /// Creates a new node and assigns an icon
        /// </summary>
        protected virtual TreeNodePath CreateTreeNode(System.Windows.Forms.TreeNodeCollection parentCollection, TreeNodePath parentNode, string text, string path, bool isFile, bool addDummyNode, bool isSpecialFolder)
        {
            TreeNodePath node = Helper.CreateTreeNode(parentCollection != null ? parentCollection : parentNode.Nodes, parentNode, text, path, addDummyNode, false, isSpecialFolder);

            try
            {
                SetIcon(Helper.TreeView, node);
            }
            catch
            {
                node.ImageIndex         = -1;
                node.SelectedImageIndex = -1;
            }
            return(node);
        }
        // <summary>
        // Helper function to replace child state with that of the parent
        // </summary>
        public void UpdateChildState(System.Windows.Forms.TreeNodeCollection Nodes, int StateImageIndex, bool Checked, bool ChangeUninitialisedNodesOnly)
        {
            foreach (System.Windows.Forms.TreeNode tnChild in Nodes)
            {
                if (!ChangeUninitialisedNodesOnly || tnChild.StateImageIndex == -1)
                {
                    tnChild.StateImageIndex = StateImageIndex;
                    tnChild.Checked         = Checked;                  // override 'checked' state of child with that of parent

                    if (tnChild.Nodes.Count > 0)
                    {
                        UpdateChildState(tnChild.Nodes, StateImageIndex, Checked, ChangeUninitialisedNodesOnly);
                    }
                }
            }
        }
        protected void UpdateChildState(System.Windows.Forms.TreeNodeCollection Nodes, int StateImageIndex, bool Checked, bool ChangeUninitialisedNodesOnly)
        {
            foreach (System.Windows.Forms.TreeNode tnChild in Nodes)
            {
                if (!ChangeUninitialisedNodesOnly || tnChild.StateImageIndex == -1)
                {
                    tnChild.StateImageIndex = StateImageIndex;
                    tnChild.Checked         = Checked;

                    if (tnChild.Nodes.Count > 0)
                    {
                        UpdateChildState(tnChild.Nodes, StateImageIndex, Checked, ChangeUninitialisedNodesOnly);
                    }
                }
            }
        }
示例#15
0
 private System.Windows.Forms.TreeNode LoadTreeNode(
     System.Exception ex,
     System.Windows.Forms.TreeNodeCollection t)
 {
     System.Windows.Forms.TreeNode tnode = new System.Windows.Forms.TreeNode();
     System.Windows.Forms.TreeNode nodeDeep;
     tnode.Text = ex.GetType().Name;
     tnode.Tag  = ex;
     t.Add(tnode);
     if (ex.InnerException == null)
     {
         return(tnode);
     }
     else
     {
         return(LoadTreeNode(ex.InnerException, tnode.Nodes));
     }
 }
        /// <summary>
        /// Creates a tree node and add it to the <c>TreeNodeCollection</c>.
        /// </summary>
        /// <param name="parentCollection"><c>TreeNodeCollection</c> to which the new node will added.</param>
        /// <param name="parentNode">Parent node for the new created child node.</param>
        /// <param name="text">The text displayed in the label of the tree node.</param>
        /// <param name="path">The path the node represents.</param>
        /// <param name="addDummyNode">True to add + sign, otherwise no + sign appears.</param>
        /// <param name="forceChecked">True to check node in each case, otherwise false to allow normal check against selected paths.</param>
        /// <param name="isSpecialFolder">Specifies if this node is a special folder. Special folders do not request data from the attached data provider.</param>
        /// <returns>The newly created and added node</returns>
        public virtual TreeNodePath CreateTreeNode(System.Windows.Forms.TreeNodeCollection parentCollection, TreeNodePath parentNode, string text, string path, bool addDummyNode, bool forceChecked, bool isSpecialFolder)
        {
            if (parentCollection == null)
            {
                throw new ArgumentNullException("parentCollection");
            }
            //
            if (_treeView.InvokeRequired)
            {
                return(_treeView.Invoke(new CreateTreeNodeDelegate(CreateTreeNode), new object[] { parentNode, text, path, addDummyNode, forceChecked, isSpecialFolder }) as TreeNodePath);
            }
            //
            forceChecked = forceChecked || (TreeView.CheckBoxBehaviorMode == CheckBoxBehaviorMode.RecursiveChecked && (parentNode != null && parentNode.Checked));
            //
            TreeNodePath childNode = CreateTreeNode(text, path, addDummyNode, forceChecked, isSpecialFolder);

            parentCollection.Add(childNode);
            return(childNode);
        }
示例#17
0
        private CheckedCounter PrepareNodeCounterOne(System.Windows.Forms.TreeNodeCollection nodes)
        {
            CheckedCounter cnt = new CheckedCounter();

            foreach (System.Windows.Forms.TreeNode node in nodes)
            {
                node.StateImageIndex = (int)CheckedState.UnChecked;
                CheckedCounter tmp;
                if (node.Nodes.Count == 0)
                {
                    tmp = new CheckedCounter(node.StateImageIndex == (int)CheckedState.Checked ? 1 : 0, 1);
                }
                else
                {
                    tmp = PrepareNodeCounterOne(node.Nodes);
                }
                node.Tag = tmp;
                cnt      = cnt + tmp;
            }
            return(cnt);
        }
示例#18
0
        protected virtual TreeNodePath CreateTreeNode(System.Windows.Forms.TreeNodeCollection parentCollection, TreeNodePath parentNode, Raccoom.Win32.ShellItem shellItem)
        {
            if (shellItem == null)
            {
                throw new ArgumentNullException("shellItem");
            }
            //
            TreeNodePath node = CreateTreeNode(parentCollection, parentNode, shellItem.Text, shellItem.Path, !shellItem.IsFolder, shellItem.HasSubfolder, !shellItem.IsFileSystem);

            node.ImageIndex         = shellItem.ImageIndex;
            node.SelectedImageIndex = shellItem.SelectedImageIndex;
            node.Tag = shellItem;
            //
            shellItem.ShellItemUpdated += delegate(object sender, EventArgs e)
            {
                node.Text               = shellItem.Text;
                node.ImageIndex         = shellItem.ImageIndex;
                node.SelectedImageIndex = shellItem.SelectedImageIndex;
            };
            return(node);
        }
示例#19
0
        public void ShowNodeFullPath(System.Windows.Forms.TreeNodeCollection nodeCollection, string folder)
        {
            // load on demand was not fired till now
            if (nodeCollection.Count == 1 && ((TreeNodePath)nodeCollection[0]).Path == null)
            {
                nodeCollection[0].Parent.Expand();
            }


            if (!string.IsNullOrEmpty(folder))
            {
                string[] subs = folder.Split('\\');

                int column = 0;
                foreach (string dir in subs)
                {
                    foreach (TreeNodePath n in nodeCollection)
                    {
                        if (n.Text.ToLower() == dir.ToLower())
                        {
                            nodeCollection = n.Nodes; //Get ready for child leafs

                            if (column == subs.Length - 1)
                            {
                                n.EnsureVisible();
                                Helper.TreeView.SelectedNode = n;
                            }
                            else
                            {
                                n.Expand();
                            }
                            break;
                        }
                    }
                    column++;
                }
            }
        }
示例#20
0
        // <summary>
        // Helper function to replace child state with that of the parent
        // </summary>
        protected void UpdateChildState(System.Windows.Forms.TreeNodeCollection Nodes, int StateImageIndex, bool Checked, bool ChangeUninitialisedNodesOnly, bool TreeViewLoad)
        {
            bool noChecado = false;

            foreach (System.Windows.Forms.TreeNode tnChild in Nodes)
            {
                noChecado = TreeViewLoad == true ? tnChild.Checked : Checked;
                if (!ChangeUninitialisedNodesOnly || tnChild.StateImageIndex == -1)
                {
                    tnChild.StateImageIndex = StateImageIndex;
                    tnChild.Checked         = noChecado; //;  override 'checked' state of child with that of parent

                    if (tnChild.Nodes.Count > 0)
                    {
                        UpdateChildState(tnChild.Nodes, StateImageIndex, Checked, ChangeUninitialisedNodesOnly, noChecado);
                    }
                    else if (tnChild.Nodes.Count == 0 && TreeViewLoad)
                    {
                        UpdateParentState(tnChild.Parent);
                    }
                }
            }
        }
示例#21
0
        /// <summary>
        /// Add a ChildNode (and all it's subChilds) to a TreeNode
        /// </summary>
        /// <param name="parent">The parent TreeNode</param>
        /// <param name="index">The Index of the Child Block in the Parent</param>
        /// <param name="child">The ChildBlock (can be null)</param>
        protected void AddChildNode(System.Windows.Forms.TreeNodeCollection parent, int index, SimPe.Interfaces.Scenegraph.ICresChildren child)
        {
            //Make the user aware, that a Node was left out!
            if (child == null)
            {
                System.Windows.Forms.TreeNode unode = new System.Windows.Forms.TreeNode("[Error: Unsupported Child on Index " + index.ToString() + "]");
                unode.Tag                = index;
                unode.ImageIndex         = 4;
                unode.SelectedImageIndex = 4;
                parent.Add(unode);
                return;
            }

            System.Windows.Forms.TreeNode node = new System.Windows.Forms.TreeNode("0x" + index.ToString("X") + ": " + child.ToString());
            node.Tag                = index;
            node.ImageIndex         = child.ImageIndex;
            node.SelectedImageIndex = node.ImageIndex;
            parent.Add(node);

            foreach (int i in child.ChildBlocks)
            {
                AddChildNode(node.Nodes, i, child.GetBlock(i));
            }
        }
 /// <summary>
 /// Popluates the MyComputer node
 /// </summary>
 /// <param name="folderItem"></param>
 /// <param name="parentCollection"></param>
 /// <param name="helper"></param>
 protected virtual void FillMyComputer(Raccoom.Win32.ShellItem folderItem, System.Windows.Forms.TreeNodeCollection parentCollection, TreeViewFolderBrowserNodeFactory helper)
 {
     _rootCollection = parentCollection;
     // get wmi logical disk's if we have to
     System.IO.DriveInfo driveInfo;
     //
     folderItem.Expand(true, true, System.IntPtr.Zero);
     //
     foreach (Raccoom.Win32.ShellItem fi in folderItem.SubFolders)
     {
         // only File System shell objects ?
         if (!_showAllShellObjects && !fi.IsFileSystem) continue;
         //
         if (DriveTypes != DriveTypes.All && fi.IsDisk)
         {
             driveInfo = new System.IO.DriveInfo(fi.Path);
             //
             switch (driveInfo.DriveType)
             {
                 case System.IO.DriveType.CDRom:
                     if ((DriveTypes & DriveTypes.CompactDisc) == 0) continue;
                     break;
                 case System.IO.DriveType.Fixed:
                     if ((DriveTypes & DriveTypes.LocalDisk) == 0) continue;
                     break;
                 case System.IO.DriveType.Network:
                     if ((DriveTypes & DriveTypes.NetworkDrive) == 0) continue;
                     break;
                 case System.IO.DriveType.NoRootDirectory:
                     if ((DriveTypes & DriveTypes.NoRootDirectory) == 0) continue;
                     break;
                 case System.IO.DriveType.Ram:
                     if ((DriveTypes & DriveTypes.RAMDisk) == 0) continue;
                     break;
                 case System.IO.DriveType.Removable:
                     if ((DriveTypes & DriveTypes.RemovableDisk) == 0) continue;
                     break;
                 case System.IO.DriveType.Unknown:
                     if ((DriveTypes & DriveTypes.NoRootDirectory) == 0) continue;
                     break;
             }
         }
         // create new node
         TreeNodePath node = CreateTreeNode(parentCollection, null, fi);
     }
 }
 public static IEnumerable <System.Windows.Forms.TreeNode> AsEnumerable(
     this System.Windows.Forms.TreeNodeCollection source)
 {
     TypeCheckEnumerable(source, (s) => s.AsEnumerable(), (s) => s[0]);
     return(source.Cast <System.Windows.Forms.TreeNode>());
 }
        /// <summary>
        /// Internal helper methods to create nodes and assign them as root or child nodes.
        /// </summary>
        /// <param name="helper"></param>
        /// <param name="parentNode"></param>
        /// <param name="parentCollection"></param>
        private void RequestHelper(TreeViewFolderBrowserNodeFactory helper, TreeNodePath parentNode, System.Windows.Forms.TreeNodeCollection parentCollection)
        {
            FTPLib.FtpClient ftp = FTP;

            if (parentNode != null)
            {
                ftp.ChangeDir(parentNode.Path);
            }
            else
            {
                ftp.ChangeDir(_directorySeparatorChar);
            }
            //
            foreach (FTPLib.ServerFileData serverData in ftp.List())
            {
                // skip files if there should not be filled in
                if (!serverData.isDirectory && !ShowFiles)
                {
                    continue;
                }
                //
                CreateTreeNode(parentNode,
                               serverData.fileName, parentNode != null ? parentNode.Path + "/" + serverData.fileName : _directorySeparatorChar + serverData.fileName,
                               !serverData.isDirectory,
                               serverData.isDirectory,
                               false);
            }
            //
            return;
        }
 public bool SetSelection(object value, System.Windows.Forms.TreeNodeCollection nodes)
 {
 }
        public override void RequestRootNode()
        {
            // do not call base class here
            // base.RequestRootNode();

            AttachSystemImageList(Helper);
            // setup up root node collection
            switch (RootFolder)
            {
                case Raccoom.Win32.ShellAPI.CSIDL.DESKTOP :
                    // create root node <Desktop>
                    TreeNodePath desktopNode = CreateTreeNode(Helper.TreeView.Nodes, null, _shell.DesktopItem);
                    _rootCollection = desktopNode.Nodes;
                    // enable shell objects always to fill desktop level
                    bool settingBackup = _showAllShellObjects;
                    _showAllShellObjects = true;
                    // set setting back to original value
                    _showAllShellObjects = settingBackup;
                    break;
                case  Raccoom.Win32.ShellAPI.CSIDL.DRIVES:
                    this.FillMyComputer(_shell.MyComputerItem, Helper.TreeView.Nodes, Helper);
                    break;
                default:
                    //
                    TreeNodePath rootNode = CreateTreeNode(Helper.TreeView.Nodes, null, _shell.GetSpecialFolderShellItem(RootFolder));
                    if (!rootNode.HasDummyNode) rootNode.AddDummyNode();
                    _rootCollection = rootNode.Nodes;
                    break;
            }
        }
示例#27
0
 private void uiComboTreeView2_NodesSelected(object sender, System.Windows.Forms.TreeNodeCollection node)
 {
     ShowInfoTip(uiComboTreeView2.Text);
 }
示例#28
0
 public override void InsertTreeNode(System.Windows.Forms.TreeNodeCollection siblingNodes, Microsoft.VisualStudio.Modeling.Shell.ExplorerTreeNode node)
 {
     base.InsertTreeNode(siblingNodes, node);
     //ResetIcons(node.TreeView.ImageList);
 }
 /// <summary>
 /// Focus the specified folder and scroll it in to view.
 /// </summary>
 /// <param name="directoryPath">The path which should be focused</param>
 public override void ShowNode(string directoryPath)
 {
     if ((directoryPath == null) || (directoryPath == "") || (directoryPath == string.Empty))
     {
         return;
     }
     // start search at root node
     System.Windows.Forms.TreeNodeCollection nodeCol = RequestDriveCollection();
     //
     if (!System.IO.Directory.Exists(directoryPath) || nodeCol == null)
     {
         return;
     }
     //
     System.IO.DirectoryInfo dirInfo = new System.IO.DirectoryInfo(directoryPath);
     // get path tokens
     System.Collections.ArrayList dirs = new System.Collections.ArrayList();
     dirs.Add(dirInfo.FullName);
     //
     while (dirInfo.Parent != null)
     {
         dirs.Add(dirInfo.Parent.FullName);
         //
         dirInfo = dirInfo.Parent;
     }
     // try to expand all path tokens
     Helper.TreeView.Cursor = System.Windows.Forms.Cursors.WaitCursor;
     Helper.TreeView.BeginUpdate();
     // load on demand was not fired till now
     if (nodeCol.Count == 1 && ((TreeNodePath)nodeCol[0]).Path == null)
     {
         nodeCol[0].Parent.Expand();
     }
     try
     {
         //
         for (int i = dirs.Count - 1; i >= 0; i--)
         {
             foreach (TreeNodePath n in nodeCol)
             {
                 if (n.Path.ToLower().CompareTo(dirs[i].ToString().ToLower()) == 0)
                 {
                     nodeCol = n.Nodes;
                     if (i == 0)
                     {
                         n.EnsureVisible();
                         Helper.TreeView.SelectedNode = n;
                     }
                     else
                     {
                         n.Expand();
                     }
                     break;
                 }
             }
         }
     }
     catch (System.Exception e)
     {
         throw e;
     }
     finally
     {
         Helper.TreeView.EndUpdate();
         Helper.TreeView.Cursor = System.Windows.Forms.Cursors.Default;
     }
 }
示例#30
0
        /// <summary>
        /// Popluates the MyComputer node
        /// </summary>
        /// <param name="folderItem"></param>
        /// <param name="parentCollection"></param>
        /// <param name="helper"></param>
        protected virtual void FillMyComputer(Raccoom.Win32.ShellItem folderItem, System.Windows.Forms.TreeNodeCollection parentCollection, TreeViewFolderBrowserNodeFactory helper)
        {
            _rootCollection = parentCollection;
            // get wmi logical disk's if we have to
            System.IO.DriveInfo driveInfo;
            //
            folderItem.Expand(true, true, System.IntPtr.Zero);
            //
            foreach (Raccoom.Win32.ShellItem fi in folderItem.SubFolders)
            {
                // only File System shell objects ?
                if (!_showAllShellObjects && !fi.IsFileSystem)
                {
                    continue;
                }
                //
                if (DriveTypes != DriveTypes.All && fi.IsDisk)
                {
                    driveInfo = new System.IO.DriveInfo(fi.Path);
                    //
                    switch (driveInfo.DriveType)
                    {
                    case System.IO.DriveType.CDRom:
                        if ((DriveTypes & DriveTypes.CompactDisc) == 0)
                        {
                            continue;
                        }
                        break;

                    case System.IO.DriveType.Fixed:
                        if ((DriveTypes & DriveTypes.LocalDisk) == 0)
                        {
                            continue;
                        }
                        break;

                    case System.IO.DriveType.Network:
                        if ((DriveTypes & DriveTypes.NetworkDrive) == 0)
                        {
                            continue;
                        }
                        break;

                    case System.IO.DriveType.NoRootDirectory:
                        if ((DriveTypes & DriveTypes.NoRootDirectory) == 0)
                        {
                            continue;
                        }
                        break;

                    case System.IO.DriveType.Ram:
                        if ((DriveTypes & DriveTypes.RAMDisk) == 0)
                        {
                            continue;
                        }
                        break;

                    case System.IO.DriveType.Removable:
                        if ((DriveTypes & DriveTypes.RemovableDisk) == 0)
                        {
                            continue;
                        }
                        break;

                    case System.IO.DriveType.Unknown:
                        if ((DriveTypes & DriveTypes.NoRootDirectory) == 0)
                        {
                            continue;
                        }
                        break;
                    }
                }
                // create new node
                TreeNodePath node = CreateTreeNode(parentCollection, null, fi);
            }
        }
			public void InitializeExtractionForTagHierarchy(System.Windows.Forms.TreeNodeCollection nodes,
				bool all, bool r_checked)
			{
				m_extractAllNodes = nodes;
				m_extractAll = all;
				m_extractAllChecked = r_checked;
			}