// Find the specified object internal static ObjectTreeNode FindObject(Object obj, bool createObj) { ArrayList nodes = new ArrayList(); SearchFor(null, obj, ObjectBrowser.ObjTree.Nodes, nodes); if (nodes.Count > 0) { return((ObjectTreeNode)nodes[0]); } else { if (createObj) { if (TraceUtil.If(null, TraceLevel.Verbose)) { Trace.WriteLine("FindObj - not found - creating"); } ObjectTreeNode tlNode = ObjectBrowser.GetTopLevelObjectNode(); tlNode.AddObject(obj); ObjectTreeNode node = FindObject(obj, false); if (TraceUtil.If(null, TraceLevel.Verbose)) { Trace.WriteLine("FindObj - found created node: " + node); } return(node); } return(null); } }
protected void ComponentsCreated(Object sender, ToolboxComponentsCreatedEventArgs e) { foreach (IComponent c in e.Components) { if (c == null) { continue; } ObjectBrowser.GetTopLevelObjectNode().AddNewObject(c, null); } }