private void Form1_LoadGed(object sender, EventArgs e) { //logit("LoadGed 1", true); Forest gedtrees = new Forest(); // TODO Using LastFile is a hack... pass path in args? not as event? gedtrees.LoadGEDCOM(LastFile); //logit("LoadGed 2"); // populate combobox with individuals // www.ahnenbuch.de-AMMON has multiple individuals with the same name. Need to distinguish // them somehow for the combobox. // TODO is there a better way? unique thing for combobox selection? HashSet <string> comboNames = new HashSet <string>(); foreach (var indiId in gedtrees.AllIndiIds) { Person p = gedtrees.PersonById(indiId); // for each person, show the # of individuals available in (first) pedigree Pedigrees pd = new Pedigrees(p, firstOnly: true); p.Ahnen = pd.GetPedigreeMax(0); var text = string.Format("{0} [{1}] ({2})", p.Name, indiId, p.Ahnen); comboNames.Add(text); _cmbItems.Add(new { Text = text, Value = p }); } cmbPerson.DisplayMember = "Text"; cmbPerson.ValueMember = "Value"; cmbPerson.DataSource = _cmbItems; cmbPerson.Enabled = true; //logit("LoadGed 4"); }
void Form1_LoadGed(object sender, EventArgs e) { gedtrees = new Forest(); gedtrees.LoadGEDCOM(LastFile); DateEstimator.Estimate(gedtrees); foreach (var union in gedtrees.AllUnions) { var text = union.Id; // TODO add spouse names _cmbItems.Add(new { Text = text, Value = union }); } cmbFamilies.DisplayMember = "Text"; cmbFamilies.ValueMember = "Value"; cmbFamilies.DataSource = _cmbItems; cmbFamilies.SelectedIndex = 0; cmbFamilies.Enabled = rbFamGroup.Checked; // populate combobox with individuals // www.ahnenbuch.de-AMMON has multiple individuals with the same name. Need to distinguish // them somehow for the combobox. // TODO is there a better way? unique thing for combobox selection? HashSet <string> comboNames = new HashSet <string>(); foreach (var indiId in gedtrees.AllIndiIds) { Person p = gedtrees.PersonById(indiId); // for each person, show the # of individuals available in (first) pedigree Pedigrees pd = new Pedigrees(p, firstOnly: true); p.Ahnen = pd.GetPedigreeMax(0); var text = string.Format("{0} [{1}] ({2})", p.Name, indiId, p.Ahnen); comboNames.Add(text); _cmbPedItems.Add(new { Text = text, Value = p }); } cmbPerson.DisplayMember = "Text"; cmbPerson.ValueMember = "Value"; cmbPerson.DataSource = _cmbPedItems; cmbPerson.SelectedIndex = 0; cmbPerson.Enabled = !rbFamGroup.Checked; }