/// <summary> /// Child <see cref="IPanel.Closed"/> event handler. /// </summary> /// <param name="sender">Event sender.</param> /// <param name="e">Event params.</param> private void OnChildClose(object sender, EventArgs e) { var panel = sender as IPanel; if (Childs.Contains(panel)) { int panelIndex = Childs.IndexOf(panel); Childs.Remove(panel); if (Active == panel && Childs.Count > 0) { // Todo: Make this configurable - after child panel is closed, make next OR prev child panel active. int newActiveIndex = panelIndex < Childs.Count ? panelIndex : Childs.Count - 1; Active = Childs[newActiveIndex]; } } if (Childs.Count == 0 && !isClosing) { active = null; RequestClose(); } }
public void DeleteNode(TreeNode <T> _node) { if (Childs.Contains(_node)) { Childs.Remove(_node); _node = null; } }
public void AddDescendant(GroupInfo group) { if (group != null && !Childs.Contains(group)) { group.Parent = this; group.CategoryID = CategoryID; Childs.Add(group); } }
/// <summary> /// Parents "greater" than children, so after OrderBy children proceeded first /// </summary> public int CompareTo(Type other) { if (Childs.Contains(other)) { return(1); } if (Parents.Contains(other)) { return(-1); } return(0); }
private Action <TUpdate, T> GetSetter <TUpdate>() { if (!Childs.Contains(typeof(TUpdate))) { throw new ArgumentException("{0} is not child of {1}".FormatStr(typeof(TUpdate), typeof(T))); } var s = GetSetterInner <TUpdate>(); if (s == null) { throw new NotImplementedException(); } return(s); }
public void FillParentsAndChildren() { foreach (var item in ParentChildrenRelation) { // if he is a parent if (item.ParentInformation == this.Name || item.ParentInformation == this.Birthday) { if (!Childs.Contains(NamesBirthdays.Where(x => x.Name == item.ChildInformatio || x.Birthday == item.ChildInformatio).First())) { Childs.Add(NamesBirthdays.Where(x => x.Name == item.ChildInformatio || x.Birthday == item.ChildInformatio).First()); } } // if he is a child if (item.ChildInformatio == this.Name || item.ChildInformatio == this.Birthday) { if (!Parents.Contains(NamesBirthdays.Where(x => x.Name == item.ParentInformation || x.Birthday == item.ParentInformation).First())) { Parents.Add(NamesBirthdays.Where(x => x.Name == item.ParentInformation || x.Birthday == item.ParentInformation).First()); } } } }