//----------------------------------------------------------------------- public ProjectViewTool(Workspace workspace) : base(workspace, "ProjectView") { DefaultPositionDocument = ToolPosition.ProjectView; VisibleByDefault = true; Instance = this; Reload(); }
//----------------------------------------------------------------------- public ProjectItem(Workspace workspace, ProjectItem parent, ProjectViewTool tool, string name, bool skipLoadAndAdd = false) { this.Workspace = workspace; this.Parent = parent; this.Tool = tool; this.Name = name; if (Name == "Backups") { return; } if (!tool.ExpansionMap.ContainsKey(Path)) { tool.ExpansionMap[Path] = false; } if (!skipLoadAndAdd) { if (Parent != null) { var existing = Parent.Children.FirstOrDefault(e => e.Name == name); if (existing != null) { Parent.Children.Remove(existing); } } if (IsDirectory) { Load(); if (Children.Count > 0) { Parent?.Children.Add(this); } } else { if (IsDataFile(Extension) && CheckIsValid()) { Parent?.Children.Add(this); } } } PropertyChanged += (e, args) => { if (args.PropertyName == "Children") { Tool.DeferredRefresh(); } }; }