// public String AddNewImage(String ParentNodeString, PropertyChangedEventHandler evtPropertyChange) { String new_label = ""; BaseStruct parent_node = m_ObjectList; try { // if (IsNameAvailable(m_iObjectCounter.ToString()) == false) { return(""); } // Find the selected node to be the Parent if (ParentNodeString != "ROOT") { // Find the selected node to be a parent BaseStruct obj = m_ObjectList.FindChildNode(m_ObjectList, ParentNodeString); if (obj != null) { parent_node = obj; } } // Add new node into the root using (ImageStruct obj = new ImageStruct()) { obj.Name = m_iObjectCounter.ToString(); // parent_node.AddChildNode(obj); // new_label = "image_" + obj.Name; obj.PropertyChanged += evtPropertyChange; } // m_iObjectCounter++; } catch (Exception) { new_label = ""; } return(new_label); }
// public object GetObject(String strName) { BaseStruct obj = null; try { string[] piece = strName.Split('_'); if (piece.Length >= 2) { obj = m_ObjectList.FindChildNode(m_ObjectList, piece[1]); } } catch (Exception) { } return(obj); }
// public BaseStruct FindChildNode(BaseStruct Obj, String NodeName) { BaseStruct ret = null; foreach (BaseStruct bs in Obj.m_ChildNodes) { if (bs.m_ChildNodes.Count > 0) { ret = FindChildNode(bs, NodeName); if (ret != null) { return(ret); } } // if (bs.Name == NodeName) { ret = bs; break; } } return(ret); }
// public ObjectManage() { m_ObjectList = new BaseStruct(); m_iObjectCounter = 1; }
// public void AddChild(BaseStruct Node) { AddChildNode(Node); }
// public void AddChildNode(BaseStruct Obj) { m_ChildNodes.Add(Obj); }