private static void LoadChildren(System.Windows.Forms.BindingSource parentBS, System.Windows.Forms.BindingSource childBS) { if (!parentBS.get_IsBindingSuspended()) { LocalAddress parent = parentBS.get_Current() as LocalAddress; if (parent != null) { childBS.SuspendBinding(); if (parent == LocalAddress.Null) { childBS.Clear(); childBS.Add(LocalAddress.Null); } else { ObjectList<LocalAddress> list = new ObjectList<LocalAddress>(); ObjectList<LocalAddress> children = Mappers.LocalAddressMapper.GetChildren(parent); if (children.get_Count() == 1) { list.AddRange(children); list.Add(LocalAddress.Null); } else { list.Add(LocalAddress.Null); list.AddRange(children); } childBS.set_DataSource(list); } int index = childBS.IndexOf(LocalAddress.Null); childBS.ResumeBinding(); childBS.set_Position(((childBS.get_Count() == 2) && !((LocalAddress) childBS.get_Item(0)).Name.Equals(string.Empty)) ? ((int) 0) : index); } } }
private static void LoadChildren(System.Windows.Forms.BindingSource parentBS, System.Windows.Forms.BindingSource childBS) { if (!parentBS.get_IsBindingSuspended()) { LocalAddress parent = parentBS.get_Current() as LocalAddress; if (parent != null) { childBS.SuspendBinding(); if (parent == LocalAddress.Null) { childBS.Clear(); } else { childBS.set_DataSource(House.GetChildrenAddress(parent)); } int num = childBS.Add(LocalAddress.Null); childBS.ResumeBinding(); childBS.set_Position((childBS.get_Count() == 2) ? ((int) 0) : num); } } }
private static void LoadChildren(System.Windows.Forms.BindingSource parentBS, System.Windows.Forms.BindingSource childBS) { if (!parentBS.get_IsBindingSuspended()) { LocalAddress parent = parentBS.get_Current() as LocalAddress; if (parent != null) { childBS.SuspendBinding(); if (parent == LocalAddress.Null) { childBS.Clear(); } else { childBS.set_DataSource(Mappers.LocalAddressMapper.GetChildren(parent)); } int num = childBS.Add(LocalAddress.Null); childBS.ResumeBinding(); childBS.set_Position(((childBS.get_Count() == 2) && !((LocalAddress) childBS.get_Item(0)).Name.Equals(string.Empty)) ? ((int) 0) : num); } } }