private void fileExplorer_BeforeExpand(object sender, DevComponents.AdvTree.AdvTreeNodeCancelEventArgs e) { Node parent = e.Node; if (parent.Nodes.Count > 0) { if (toRefresh) { parent.Nodes.Clear(); } else { return; } } toRefresh = false; if (parent.Tag is DInfo) { explorerTree.BeginUpdate(); DInfo driveInfo = (DInfo)parent.Tag; LoadDirectories(parent, driveInfo.dir); parent.ExpandVisibility = eNodeExpandVisibility.Auto; explorerTree.EndUpdate(true); } else if (parent.Tag is DirectoryInfo) { LoadDirectories(parent, (DirectoryInfo)parent.Tag); } }
public void FileExplorerTree_Load(object sender, EventArgs e) { DInfo d = new DInfo(); DInfo d2 = new DInfo(); explorerTree.BeginUpdate(); { DirectoryInfo driveInfo = new DirectoryInfo(GamePath + @"\Mods"); d.dir = driveInfo; d.isRoot = true; Node node = new Node(); node.Tag = d; node.Text = driveInfo.Name.Replace(@"\", ""); node.Image = global::Hapex.HapGame.Editor.Properties.Resources.Harddrive; node.Cells.Add(new Cell("Mody")); node.Cells.Add(new Cell()); explorerTree.Nodes.Add(node); // We will load drive content on demand node.ExpandVisibility = eNodeExpandVisibility.Visible; } { DirectoryInfo driveInfo2 = new DirectoryInfo(GamePath + @"\Scripts"); d2.dir = driveInfo2; d2.isRoot = true; Node node = new Node(); node.Tag = d2; node.Text = driveInfo2.Name.Replace(@"\", ""); node.Image = global::Hapex.HapGame.Editor.Properties.Resources.Harddrive; node.Cells.Add(new Cell("Skrypty")); node.Cells.Add(new Cell()); explorerTree.Nodes.Add(node); // We will load drive content on demand node.ExpandVisibility = eNodeExpandVisibility.Visible; } // Enable tree layout and display updates, performs any pending layout and display updates explorerTree.EndUpdate(); _RightAlignFileSizeStyle = new ElementStyle(); _RightAlignFileSizeStyle.TextAlignment = DevComponents.DotNetBar.eStyleTextAlignment.Far; }