private void MembersListBoxOnSelected(object sender, EventArgs e) { UsingSelectedMember(m => { Member selectedMember = EnumerableMembers.ElementAt(MembersListBox.SelectedIndex); if (m.IsBorn(UseSettings.At, UseSettings.CanBeDead)) { BornValue.Text = "Yes"; DescendantsCountValue.Enabled = true; AncestorsCountValue.Enabled = true; ChildrenCountValue.Enabled = true; SiblingsCountValue.Enabled = true; DescendantsCountValue.Text = m.Refs.GetDescendants(UseSettings).Count().ToString(); AncestorsCountValue.Text = m.Refs.GetAncestors(UseSettings).Count().ToString(); ChildrenCountValue.Text = m.Refs.Children.Count().ToString(); SiblingsCountValue.Text = m.Refs.GetSiblings(UseSettings).Count().ToString(); } else { BornValue.Text = "No"; DescendantsCountValue.Enabled = false; AncestorsCountValue.Enabled = false; ChildrenCountValue.Enabled = false; DescendantsCountValue.Text = "-"; AncestorsCountValue.Text = "-"; ChildrenCountValue.Text = "-"; SiblingsCountValue.Text = "-"; } RemoveSelectedBtn.Enabled = SourceFamily.CanBeRemoved(selectedMember); EditSelectedBtn.Enabled = true; }); }
private void RemoveSelectedMember() { UsingSelectedMember(m => { if (SourceFamily.CanBeRemoved(m) && new DestructiveConfirmDialog().ShowDialog() == DialogResult.OK) { SourceFamily.RemoveMember(m); UnsavedChanges = true; UpdateUI(); UpdateUIMembersListBox(); } }); }
private void EditSelectedMember() { UsingSelectedMember(m => { MemberEditDialog editDialog = new MemberEditDialog( SourceFamily, m ); if (editDialog.ShowDialog() == DialogResult.OK) { UnsavedChanges = true; RemoveSelectedBtn.Enabled = SourceFamily.CanBeRemoved(m); UpdateUI(); } }); }