//新建工具树 public DemoTools() { items = new List<ToolTreeItem>(); ToolTreeItem item = new ToolTreeItem("Demo|Basic", "DemoTest", callDemoWindow); items.Add(item); }
// Summary: // Add the ToolTree // Parameter: // path: path to the ToolTree // A examples of path: // "Toolsboxes|Geology|" public void add(ToolTreeItem item) { string path = item.displayPath; if (path == null || path.Length == 0) { this.items.Add(item); return; } string[] names = path.Split(new char[] { '\\', '/', '|' }); ToolTreeItem tree = this; string name = null; for (int i = 0; i < names.Count(); ++i) { name = names[i]; if (name.Length == 0) { continue; } ToolTreeItem child = tree.items.FirstOrDefault(x => x.displayName == name); if (child == null) { child = new ToolTreeItem(null, name); tree.add(child); } tree = child; } tree.items.Add(item); }
public GeologyTools() { items = new List<ToolTreeItem>(); ToolTreeItem item = new ToolTreeItem("Geology|Basic", "MakeProfile", makeProfile); items.Add(item); }
public HealthEvaluationTool() { items = new List<ToolTreeItem>(); ToolTreeItem item = new ToolTreeItem("Monitor|Basic", "HealthEvaluation", HealthEvalutation); items.Add(item); }
public ToolsPanel() { InitializeComponent(); ToolTreeItem root = new ToolTreeItem(null, "Root"); toolboxesTree = new ToolTreeItem(null, "Toolboxes"); root.add(toolboxesTree); //ToolTreeItem test1 = new ToolTreeItem("Structure|Tunnel", "Test1"); //toolboxesTree.add(test1); //ToolTreeItem tree = root.find("Toolboxes/Structure/Tunnel/Test1"); ToolsTreeView.ItemsSource = root.items; }
// Summary: // Find the ToolTree by a path and name // Remarks: // A examples of pathName: // "Toolsboxes|Geology|ToolName" public ToolTreeItem find(string pathName) { string[] names = pathName.Split(new char[] { '\\', '/', '|' }); ToolTreeItem tree = this; string name = null; for (int i = 0; i < names.Count(); ++i) { name = names[i]; tree = tree.items.FirstOrDefault(x => x.displayName == name); if (tree == null) { return(null); } } return(tree); }
// Summary: // Add the ToolTree // Parameter: // path: path to the ToolTree // A examples of path: // "Toolsboxes|Geology|" public void add(ToolTreeItem item) { string path = item.displayPath; if (path == null || path.Length == 0) { this.items.Add(item); return; } string[] names = path.Split(new char[] { '\\', '/', '|' }); ToolTreeItem tree = this; string name = null; for (int i = 0; i < names.Count(); ++i) { name = names[i]; if (name.Length == 0) continue; ToolTreeItem child = tree.items.FirstOrDefault(x => x.displayName == name); if (child == null) { child = new ToolTreeItem(null, name); tree.add(child); } tree = child; } tree.items.Add(item); }
public TunnelHealthEvaluationTool() { items = new List<ToolTreeItem>(); ToolTreeItem item = new ToolTreeItem("Monitor|Basic", "TunnelHealthEvaluation", EvaluateHealth); items.Add(item); }