/* * void CreateItems(ShellItem folder, int indent) * { * IEnumerator<ShellItem> e = folder.GetEnumerator( SHCONTF.FOLDERS | SHCONTF.INCLUDEHIDDEN); * while (e.MoveNext()) * { * CreateItem(e.Current, indent); * } * } */ /// <summary> /// Creates a <see cref="ComboItem"/> and adds it to <see cref="m_Combo"/> /// </summary> /// <param name="folder">Sets <see cref="ComboItem.Folder"/></param> /// <param name="indent">Sets <see cref="ComboItem.Indent"/></param> void CreateItem(ShellItem folder, int indent) { //TODO: Double Check recursive code int index = m_Combo.Items.Add(new ComboItem(folder, indent)); if (folder == m_SelectedFolder) { m_Combo.SelectedIndex = index; } if (folder == m_Computer || folder == ShellItem.Desktop || folder.IsParentOf(m_SelectedFolder)) { foreach (var item in folder) { CreateItem(item, indent + 1); } } }
void SelectItem(TreeNode node, ShellItem value) { CreateChildren(node); foreach (TreeNode child in node.Nodes) { ShellItem folder = (ShellItem)child.Tag; if (folder == value) { m_TreeView.SelectedNode = child; child.EnsureVisible(); child.Expand(); return; } else if (folder.IsParentOf(value)) { SelectItem(child, value); return; } } }
bool ShouldCreateChildren(ShellItem folder) { return(folder == m_Computer || folder == ShellItem.Desktop || folder.IsParentOf(m_SelectedFolder)); }