/// <summary>Returns the child with the name <paramref name="childName" /> .</summary> /// <param name="childName"> The name of the child to return. </param> /// <returns> The retrieved child. </returns> public virtual WZObject this[string childName] { get { if (!_canContainChildren) { throw new NotSupportedException("This WZObject cannot contain children."); } return(_backing.Contains(childName) ? _backing[childName] : null); } }
public void Drop(IDropInfo dropInfo) { var tex = dropInfo.Data as Texture2D; var bone = dropInfo.Data as Bone; var texArr = dropInfo.Data as List <Texture2D>; var boneArr = dropInfo.Data as List <Bone>; if (tex != null && !ChildCollection.Contains(tex)) { MainViewModel.ViewportCollection.Remove(tex); if (!ChildCollection.Contains(tex)) { ChildCollection.Add(tex); } } else if (texArr != null) { foreach (var t in texArr) { MainViewModel.ViewportCollection.Remove(t); if (!ChildCollection.Contains(t)) { ChildCollection.Add(t); } } } else if (bone != null && !ChildCollection.Contains(bone) && bone != this) { MainViewModel.ViewportCollection.Remove(bone); if (!ChildCollection.Contains(bone)) { ChildCollection.Add(bone); } } else if (boneArr != null) { foreach (var b in boneArr) { if (b != null && !ChildCollection.Contains(b) && b != this) { MainViewModel.ViewportCollection.Remove(b); if (!ChildCollection.Contains(b)) { ChildCollection.Add(b); } } } } }
/// <summary>Checks if this property has a child with name <paramref name="name" /> .</summary> /// <param name="name"> The name of the child to locate. </param> /// <returns> true if this property has such a child, false otherwise or if this property cannot contain children. </returns> public virtual bool HasChild(string name) { return(_canContainChildren && _backing.Contains(name)); }
/// <summary> /// Method to check whether a form is already a MDI child form /// </summary> /// <param name="childName">Form that needs to be validated</param> /// <returns>True/False</returns> public static bool HasChild(string childName) { return(ChildCollection.Contains(childName)); }