public bool UpdateIndividual(IndividualClass tempIndividual, PersonUpdateType updateType) { if (individualList.ContainsKey(tempIndividual.GetXrefName())) { IndividualClass updatePerson = individualList[tempIndividual.GetXrefName()]; if ((updateType & PersonUpdateType.ChildFamily) != 0) { updatePerson.SetFamilyChildList(tempIndividual.GetFamilyChildList()); } if ((updateType & PersonUpdateType.SpouseFamily) != 0) { updatePerson.SetFamilySpouseList(tempIndividual.GetFamilySpouseList()); } if ((updateType & PersonUpdateType.Name) != 0) { updatePerson.SetPersonalName(tempIndividual.GetPersonalName()); } if ((updateType & PersonUpdateType.Events) != 0) { updatePerson.SetEventList(tempIndividual.GetEventList()); } individualList[tempIndividual.GetXrefName()] = updatePerson; return(true); } else { trace.TraceEvent(TraceEventType.Error, 0, "Error: Can't update {0} as it is not in the database!", tempIndividual.GetXrefName()); } return(false); }
private void UpdateIndividual(IndividualClass person, TreeViewLayout layout, ref IndividualButton personButton, FamilyButton parentButton = null) { trace.TraceInformation("UpdateIndividual(" + person.GetXrefName() + "),gen:" + personButton.bLayout.generation + ",name:" + person.GetPersonalName().GetName()); if (personButton.individual == null) { personButton.individual = person; personButton.Refresh(); } if (!personButton.Visible) { if (!personButton.SetLayout(layout, parentButton)) { trace.TraceInformation("UpdateIndividual(" + person.GetXrefName() + "),gen:" + personButton.bLayout.generation + ")-aborted,hidden"); return; } } if (layout.VisibleButton(personButton.bLayout)) { if (layout.SearchChildren()) { UpdateFamilyList(person.GetFamilySpouseList(), personButton); } if (layout.SearchParents()) { UpdateFamilyList(person.GetFamilyChildList(), personButton); } trace.TraceInformation("UpdateIndividual(" + person.GetXrefName() + ", " + personButton.bLayout.generation + ")-done"); } else { trace.TraceInformation("UpdateIndividual(" + person.GetXrefName() + ", " + personButton.bLayout.generation + ") not visible generation => stop!"); } }
public string GetSelectedIndividual() { if (selectedIndividual != null) { return(selectedIndividual.GetXrefName()); } return(null); }
public bool AddIndividual(IndividualClass tempIndividual) { if (tempIndividual.GetXrefName().Length > 0) { individualList.Add(tempIndividual.GetXrefName(), tempIndividual); return(true); } return(false); }
void CheckF2iReferences(ref IndividualClass individual) { if (parentsF2iReference.ContainsKey(individual.GetXrefName())) { IList <string> spouses = parentsF2iReference[individual.GetXrefName()]; if (spouses.Count > individual.GetFamilySpouseList().Count) { trace.TraceData(TraceEventType.Verbose, 0, individual.GetXrefName() + " missing spouse to individual " + spouses.Count + " > " + individual.GetFamilySpouseList().Count); foreach (string parent in spouses) { individual.AddRelation(new FamilyXrefClass(parent), IndividualClass.RelationType.Spouse); trace.TraceData(TraceEventType.Verbose, 0, individual.GetXrefName() + " adding spouse-family to individual " + parent + " to " + individual.GetName()); } } } if (childrenI2fReference.ContainsKey(individual.GetXrefName())) { IList <string> children = childrenI2fReference[individual.GetXrefName()]; if (children.Count > individual.GetFamilyChildList().Count) { trace.TraceData(TraceEventType.Verbose, 0, individual.GetXrefName() + " missing child-family in individual " + children.Count + " > " + individual.GetFamilyChildList().Count); foreach (string child in children) { individual.AddRelation(new FamilyXrefClass(child), IndividualClass.RelationType.Child); trace.TraceData(TraceEventType.Verbose, 0, individual.GetXrefName() + " adding child-family to individual " + child + " to " + individual.GetName()); } } } }
void AddItemToListView(AncestorLineInfo ancestor, SanityCheckLimits limits) { IndividualClass person = familyTree.GetIndividual(ancestor.rootAncestor); if (person != null) { trace.TraceInformation(" " + ancestor.depth + " generations: " + person.GetName() + " " + person.GetDate(IndividualEventClass.EventType.Birth) + " - " + person.GetDate(IndividualEventClass.EventType.Death)); ListViewItem oldItem = resultList.FindItemWithText(person.GetName()); if (oldItem != null) { if (oldItem.Tag.ToString() == ancestor.rootAncestor) { resultList.Items.Remove(oldItem); } } string detailString = ancestor.GetDetailString(limits); if (detailString.Length > 0) { ListViewItem item = new ListViewItem(person.GetName()); item.SubItems.AddRange(new string[] { ancestor.depth.ToString(), ancestor.relationPath.GetDistance(), person.GetDate(IndividualEventClass.EventType.Birth).ToString(), person.GetDate(IndividualEventClass.EventType.Death).ToString(), detailString }); item.ToolTipText = ancestor.relationPath.ToString(familyTree, false); item.Tag = person.GetXrefName(); resultList.Items.Add(item); } //list.Items. } else { trace.TraceEvent(TraceEventType.Error, 0, " Error could not fetch " + ancestor.rootAncestor + " from tree " + ancestor.depth + " generations " + ancestor.GetDetailString(limits)); } }
void AddPersonToListView(IndividualClass person) { string birthAddress = ""; string deathAddress = ""; IndividualEventClass birthEv = person.GetEvent(IndividualEventClass.EventType.Birth); if (birthEv != null) { AddressClass address = birthEv.GetAddress(); if (address != null) { birthAddress = address.ToString(); } } IndividualEventClass deathEv = person.GetEvent(IndividualEventClass.EventType.Death); if (deathEv != null) { AddressClass address = deathEv.GetAddress(); if (address != null) { deathAddress = address.ToString(); } } ListViewItem item = new ListViewItem(person.GetName()); item.SubItems.AddRange(new string[] { person.GetDate(IndividualEventClass.EventType.Birth).ToString(), birthAddress, person.GetDate(IndividualEventClass.EventType.Death).ToString(), deathAddress }); item.Tag = person.GetXrefName(); resultList.Items.Add(item); }
private void UpdateIndividualSync(string xref, IndividualClass person) { if (person == null) { trace.TraceData(TraceEventType.Error, 0, "Requested person is null!" + xref); return; } if (xref != person.GetXrefName()) { trace.TraceData(TraceEventType.Error, 0, "Requested person doesn't match response!" + xref + "!=" + person.GetXrefName()); } if (personThreadList.ContainsKey(xref)) { personThreadList.Remove(xref); } else { trace.TraceData(TraceEventType.Error, 0, "Individual thread not added!" + xref); } if (personControlList.ContainsKey(xref)) { if (person != null) { IndividualButton personButton = personControlList[xref]; UpdateIndividual(person, layout, ref personButton); } } else { trace.TraceData(TraceEventType.Error, 0, "Individual button not added!" + xref); } }
void startButton_MouseClick(object sender, MouseEventArgs e) { trace.TraceInformation("RelationFinderPanel::startButton_MouseClick()" + DateTime.Now); if (familyTree.GetHomeIndividual() == null) { MessageBox.Show("Error: No root / base person selected!"); return; } if (selectedIndividual != null) { int noOfGenerations = AncestorStatistics.AllGenerations; RelationStackList relationList = new RelationStackList(); if (resultNoCtrl.SelectedItem.ToString() != "All") { noOfGenerations = Convert.ToInt32(resultNoCtrl.SelectedItem.ToString()); } AsyncWorkerProgress progress = new AsyncWorkerProgress(RelationProgress); //CheckRelation relation = new CheckRelation(familyTree, selectedIndividual.GetXrefName(), familyTree.GetHomeIndividual(), noOfGenerations, ref relationList); this.relWorker = new RelationTreeWorker(this, progress, selectedIndividual.GetXrefName(), familyTree.GetHomeIndividual(), noOfGenerations, familyTree); //ShowRelations(relationList.relations); //this.relationList = relationList; } else { MessageBox.Show("Error: No person selected!"); } }
public void DoWork(object sender, DoWorkEventArgs e) { string tXref = (string)e.Argument; if (familyTree != null) { trace.TraceData(TraceEventType.Information, 0, "Ask for person :" + tXref + " thread:" + Thread.CurrentThread.ManagedThreadId); IndividualClass person = familyTree.GetIndividual(tXref); if (person != null) { trace.TraceInformation("FindPersonThread(" + personXref + ")-done-ok"); if (person.GetXrefName() != tXref) { trace.TraceData(TraceEventType.Error, 0, "Wrong person found:" + person.GetXrefName() + "!=" + tXref + " thread:" + Thread.CurrentThread.ManagedThreadId); return; } personCallback(tXref, person); this.Dispose(); return; } } trace.TraceInformation("FindPersonThread(" + personXref + ")-failed"); personCallback(tXref, null); this.Dispose(); }
public void AddIndividual(IndividualClass individual) { if (individual == null) { trace.TraceData(TraceEventType.Error, 0, "GeniCache: Trying to add individual == null"); } else if (individual.GetXrefName().Length == 0) { trace.TraceEvent(TraceEventType.Error, 0, "GeniCache:AddIndividual():error: no xref!"); } else { bool relations = false; trace.TraceInformation("cached individual " + individual.GetXrefName()); if (individual.GetFamilyChildList() != null) { if (individual.GetFamilyChildList().Count > 0) { relations = true; } } if (individual.GetFamilySpouseList() != null) { if (individual.GetFamilySpouseList().Count > 0) { relations = true; } } if (!relations) { if (individual.GetPublic()) { string url = ""; IList <string> urls = individual.GetUrlList(); if (urls.Count > 0) { url = urls[0]; } trace.TraceData(TraceEventType.Information, 0, "Person has no relations! " + individual.GetXrefName() + " " + url + " " + individual.GetName()); } CheckF2iReferences(ref individual); } CacheIndividual(individual); latestUpdate = DateTime.Now; } }
public void ClickPerson(IndividualClass person) { selectedIndividual = person; if (parentForm != null) { parentForm.SetSelectedIndividual(person.GetXrefName()); } }
void CacheIndividual(IndividualClass individual) { trace.TraceInformation("CacheIndidvidual " + individual.GetXrefName() + " " + Thread.CurrentThread.GetApartmentState() + " " + Thread.CurrentThread.ManagedThreadId); lock (individuals) { if (!individuals.ContainsKey(individual.GetXrefName())) { trace.TraceInformation("cached individual-2 " + individual.GetXrefName() + " " + individuals.Count + " " + Thread.CurrentThread.ManagedThreadId); individuals.Add(individual.GetXrefName(), individual); UpdateI2fReferences(individual); latestUpdate = DateTime.Now; } else { trace.TraceInformation("skipped individual " + individual.GetXrefName() + " " + Thread.CurrentThread.GetApartmentState() + " " + Thread.CurrentThread.ManagedThreadId); } } }
public void ClickPerson(IndividualClass person) { trace.TraceInformation("AsyncTreePanel1::SetSelectedIndividual(" + person + ")"); if (familyTree != null) { selectedIndividual = person; parentForm.SetSelectedIndividual(person.GetXrefName()); } }
void saveButton_MouseClick(object sender, MouseEventArgs e) { trace.TraceInformation("PersonViewPanel1::save()"); if (selectedIndividual != null) { SetPersonProperties(ref selectedIndividual); parentForm.SetSelectedIndividual(selectedIndividual.GetXrefName()); } }
void UpdateI2fReferences(IndividualClass individual) { int checkNo = 0; int addedNo = 0; lock (childrenI2fReference) { IList <FamilyXrefClass> childFamilies = individual.GetFamilyChildList(); foreach (FamilyXrefClass family in childFamilies) { if (!childrenI2fReference.ContainsKey(family.GetXrefName())) { childrenI2fReference.Add(family.GetXrefName(), new List <string>()); } if (!childrenI2fReference[family.GetXrefName()].Contains(individual.GetXrefName())) { childrenI2fReference[family.GetXrefName()].Add(individual.GetXrefName()); addedNo++; } checkNo++; } } lock (parentsI2fReference) { IList <FamilyXrefClass> spouseFamilies = individual.GetFamilySpouseList(); foreach (FamilyXrefClass family in spouseFamilies) { if (!parentsI2fReference.ContainsKey(family.GetXrefName())) { parentsI2fReference.Add(family.GetXrefName(), new List <string>()); } if (!parentsI2fReference[family.GetXrefName()].Contains(individual.GetXrefName())) { parentsI2fReference[family.GetXrefName()].Add(individual.GetXrefName()); } checkNo++; } addedNo++; } }
private void IndividualControl3_MouseLeftButtonDown(object sender, MouseEventArgs e) { if (trace.Switch.Level.HasFlag(SourceLevels.Information)) { if (m_Individual != null) { trace.TraceInformation("IndividualControl3_MouseLeftButtonDown():" + m_Individual.GetName()); } else { trace.TraceInformation("IndividualControl3_MouseLeftButtonDown():null"); } trace.TraceInformation("IndividualControl3_MouseLeftButtonDown():" + this.ToString() + " " + this.Height); trace.TraceInformation("IndividualControl3_MouseLeftButtonDown():this.Parent.ToString:" + this.Parent.ToString()); } if (this.Parent.GetType() == typeof(FamilyForm2)) { FamilyForm2 fForm = (FamilyForm2)this.Parent; fForm.SetSelectedIndividual(m_Individual.GetXrefName()); } }
public override void OnSelectedPersonChangedEvent(object sender, PersonChangeEvent e) { if (familyTree != null) { selectedIndividual = e.selectedPerson; trace.TraceInformation("OnSelectedPersonChangedEvent(" + selectedIndividual.GetXrefName() + ")"); StartRefreshTimer(true); //ShowActiveFamily(); } else { trace.TraceInformation("OnSelectedPersonChangedEvent(null)"); } }
/*public void SetSelectedIndividual(String xrefName) * { * trace.TraceInformation("TreeViewPanel2::SetSelectedIndividual(" + xrefName + ")"); * if (familyTree != null) * { * selectedIndividual = (IndividualClass)familyTree.GetIndividual(xrefName); * * ShowActiveFamily(); * } * }*/ public void ClickSelectedIndividual(IndividualClass individual) { trace.TraceInformation("TreeViewPanel2::ClickSelectedIndividual(" + individual.GetPersonalName().GetName() + ")"); if (familyTree != null) { selectedIndividual = individual; ShowActiveFamily(); if (parentForm != null) { parentForm.SetSelectedIndividual(individual.GetXrefName()); } } }
void StartSearch() { trace.TraceInformation("ComparePanel1::StartSearch()" + DateTime.Now); if (familyTree == null) { return; } //parentForm. //startButton.Enabled = false; //dateButton.Enabled = false; resultList.Items.Clear(); trace.TraceInformation("search:" + searchTextBox.Text + " " + DateTime.Now); if (searchTextBox.Text.Length > 0) { IEnumerator <IndividualClass> iterator; searchTextBox.Items.Add(searchTextBox.Text); iterator = familyTree.SearchPerson(searchTextBox.Text); if (iterator != null) { while (iterator.MoveNext()) { IndividualClass person = (IndividualClass)iterator.Current; if (person != null) { ListViewItem item = new ListViewItem(person.GetName()); item.SubItems.AddRange(new string[] { person.GetDate(IndividualEventClass.EventType.Birth).ToString(), person.GetDate(IndividualEventClass.EventType.Death).ToString() }); item.Tag = person.GetXrefName(); resultList.Items.Add(item); } } } } trace.TraceInformation(" Database: " + familyTree.GetSourceFileName() + " " + DateTime.Now); }
private void ShowActiveFamily() { trace.TraceInformation("TreeViewPanel4::ShowActiveFamily (start) " + this.CanFocus); while (controlList.Count > 0) { Control ctrl = controlList[0]; this.Controls.Remove(ctrl); ctrl.Dispose(); controlList.RemoveAt(0); //ctrl. } selectedFamily = null; if (selectedIndividual != null) { //int pos = 0; System.Drawing.Point position = new Point(0, 0); int ctrlHeight = 0; { IList <FamilyXrefClass> children = selectedIndividual.GetFamilyChildList(); //trace.TraceInformation("GetFamilyChildList"); if (children != null) { //trace.TraceInformation("Children.count = " + children.Count); foreach (FamilyXrefClass childXref in children) { FamilyClass childFamily = new FamilyClass(); childFamily = familyTree.GetFamily(childXref.GetXrefName()); if (childFamily != null) { trace.TraceInformation(" parentFamily:" + childFamily.GetXrefName()); if (childFamily != null) { if (childFamily.GetParentList() != null) { foreach (IndividualXrefClass parentXref in childFamily.GetParentList()) { IndividualClass parent = new IndividualClass(); parent = familyTree.GetIndividual(parentXref.GetXrefName()); if (parent != null) { IndividualButton ctrl2 = new IndividualButton(); //int position.Y = 0; if (ctrlHeight == 0) { Label label = new Label(); label.Top = position.Y; label.Left = position.X; label.Text = "Parents:"; this.Controls.Add(label); controlList.Add(label); position.Y += label.Height; } ctrl2.AutoSize = true; ctrl2.Left = position.X; ctrl2.Top = position.Y; //ctrl.Height = 100; //ctrl.Width = 400; ctrl2.Text = parent.GetName() + "\n" + parent.GetDate(IndividualEventClass.EventType.Birth).ToString() + " - " + parent.GetDate(IndividualEventClass.EventType.Death).ToString(); trace.TraceInformation(" parent: AddControl:" + parent.GetName() + " X:" + position.X + " Y:" + position.Y + " Top:" + ctrl2.Top + " height:" + ctrl2.Height); ctrl2.FlatStyle = FlatStyle.Flat; ctrl2.individual = parent; ctrl2.SetParent(this); ctrl2.Click += new System.EventHandler(ctrl2.Clicked); //ctrl2.Anchor = AnchorStyles.Left | AnchorStyles.Top; //ctrl.Height = 40; //ctrl.Width = 40; //ctrl.Show(); controlList.Add(ctrl2); this.Controls.Add(ctrl2); position.X += ctrl2.Width; ctrlHeight = ctrl2.Height; } else { trace.TraceEvent(TraceEventType.Error, 0, "Error not a vaild person xref:" + parentXref.GetXrefName()); } } } } } else { trace.TraceEvent(TraceEventType.Error, 0, "Error not a vaild person xref:" + childXref.GetXrefName()); } } } } if (ctrlHeight != 0) { position.X = 0; position.Y += ctrlHeight; position.Y += 20; ctrlHeight = 0; } { { Label label = new Label(); label.Top = position.Y; label.Left = position.X; label.Text = "Selected:"; this.Controls.Add(label); controlList.Add(label); position.Y += label.Height; } IndividualButton ctrl = new IndividualButton(); ctrl.AutoSize = true; ctrl.Left = position.X; ctrl.Top = position.Y; //ctrl.Height = 100; //ctrl.Width = 400; ctrl.Text = selectedIndividual.GetName() + "\n" + selectedIndividual.GetDate(IndividualEventClass.EventType.Birth).ToString() + " - " + selectedIndividual.GetDate(IndividualEventClass.EventType.Death).ToString(); ctrl.Anchor = AnchorStyles.Left | AnchorStyles.Top; ctrl.FlatStyle = FlatStyle.Flat; ctrl.Click += new System.EventHandler(ctrl.Clicked); ctrl.BackColor = Color.Beige; ctrl.individual = selectedIndividual; ctrl.SetParent(this); trace.TraceInformation(" selected: AddControl:" + selectedIndividual.GetName() + " X:" + position.X + " Y:" + position.Y + " Top:" + ctrl.Top + " Height:" + ctrl.Height); controlList.Add(ctrl); this.Controls.Add(ctrl); position.X += ctrl.Width; ctrlHeight = ctrl.Height; } /*if (ctrlHeight != 0) * { * position.Y += 20; * ctrlHeight = 0; * }*/ { IList <FamilyXrefClass> spouseList = selectedIndividual.GetFamilySpouseList(); //trace.TraceInformation("GetFamilySpouseList()"); if (spouseList != null) { //trace.TraceInformation("spouses.count = " + spouseList.Count); foreach (FamilyXrefClass spouseFamilyXref in spouseList) { FamilyClass spouseFamily = new FamilyClass(); spouseFamily = familyTree.GetFamily(spouseFamilyXref.GetXrefName()); //trace.TraceInformation("spouses.count s2=" + spouseFamilyXref.GetXrefName()); if (spouseFamily != null) { trace.TraceInformation(" spouseFamily:" + spouseFamily.GetXrefName()); //trace.TraceInformation("spouses.count s3 = " + spouseFamily); if (selectedFamily == null) { selectedFamily = spouseFamily; } //trace.TraceInformation("spouses.count s4 = "); if (spouseFamily.GetParentList() != null) { foreach (IndividualXrefClass spouseXref in spouseFamily.GetParentList()) { //trace.TraceInformation("spouses.count s5 = "); if (spouseXref.GetXrefName() != selectedIndividual.GetXrefName()) { IndividualClass spouse = new IndividualClass(); spouse = familyTree.GetIndividual(spouseXref.GetXrefName()); if (spouse != null) { IndividualButton ctrl2 = new IndividualButton(); //int position.Y = 0; ctrl2.AutoSize = true; ctrl2.Left = position.X; ctrl2.Top = position.Y; ctrl2.Text = spouse.GetName() + "\r" + spouse.GetDate(IndividualEventClass.EventType.Birth).ToString() + " - " + spouse.GetDate(IndividualEventClass.EventType.Death).ToString(); ctrl2.SetParent(this); ctrl2.FlatStyle = FlatStyle.Flat; ctrl2.individual = spouse; ctrl2.Click += new System.EventHandler(ctrl2.Clicked); controlList.Add(ctrl2); this.Controls.Add(ctrl2); //ctrl2.PerformLayout(); position.X += ctrl2.Width; ctrlHeight = ctrl2.Height; trace.TraceInformation(" spouse: AddControl:" + spouse.GetName() + " X:" + position.X + " Y:" + position.Y + " Top:" + ctrl2.Top + " Height:" + ctrl2.Height); } } } } } } } } if (ctrlHeight != 0) { position.X = 0; position.Y += ctrlHeight; position.Y += 20; ctrlHeight = 0; } if (selectedFamily != null) { IList <IndividualXrefClass> childXrefList = selectedFamily.GetChildList(); trace.TraceInformation(" childFamily:" + selectedFamily.GetXrefName()); if (childXrefList != null) { foreach (IndividualXrefClass childXref in childXrefList) { IndividualClass child = new IndividualClass(); child = familyTree.GetIndividual(childXref.GetXrefName()); if (child != null) { if (ctrlHeight == 0) { Label label = new Label(); label.Top = position.Y; label.Left = position.X; label.Text = "Children:"; this.Controls.Add(label); controlList.Add(label); position.Y += label.Height; } IndividualButton ctrl2 = new IndividualButton(); //int position.Y = 0; ctrl2.AutoSize = true; ctrl2.Left = position.X; ctrl2.Top = position.Y; ctrl2.FlatStyle = FlatStyle.Flat; ctrl2.Click += new System.EventHandler(ctrl2.Clicked); //ctrl.Height = 100; //ctrl.Width = 400; ctrl2.Text = child.GetName() + "\n" + child.GetDate(IndividualEventClass.EventType.Birth).ToString() + " - " + child.GetDate(IndividualEventClass.EventType.Death).ToString(); ctrl2.individual = child; ctrl2.SetParent(this); //ctrl2.Anchor = AnchorStyles.Left | AnchorStyles.Top; //ctrl.Height = 40; //ctrl.Width = 40; //ctrl.Show(); controlList.Add(ctrl2); this.Controls.Add(ctrl2); trace.TraceInformation(" child: AddControl:" + child.GetName() + " X:" + position.X + " Y:" + position.Y + " Top:" + ctrl2.Top + " Height:" + ctrl2.Height); position.Y += ctrl2.Height; ctrlHeight += ctrl2.Height; } } } } } this.Top = 0; this.Left = 0; this.Width = 600; this.Height = 600; //this.Show(); trace.TraceInformation("TreeViewPanel4::ShowActiveFamily (end) "); }
void DecodeEvent(ref IndividualClass person, ParsePersonState evType, string eventString) { switch (evType) { case ParsePersonState.Birth: { person.AddEvent(DecodeEventType(eventString, IndividualEventClass.EventType.Birth, false)); } break; case ParsePersonState.Baptism: { person.AddEvent(DecodeEventType(eventString, IndividualEventClass.EventType.Baptism, false)); } break; case ParsePersonState.Death: { person.AddEvent(DecodeEventType(eventString, IndividualEventClass.EventType.Death, false)); } break; case ParsePersonState.Burial: { person.AddEvent(DecodeEventType(eventString, IndividualEventClass.EventType.Burial, false)); } break; case ParsePersonState.Occupation: { person.AddEvent(DecodeEventType(eventString, IndividualEventClass.EventType.Occupation, true)); } break; /*case ParsePersonState.Fosterchild: * { * IndividualEventClass occupation = new IndividualEventClass(IndividualEventClass.EventType.Adoption); * occupation.AddNote(eventString); * trace.TraceInformation("fosterchild " + eventString + " => " + occupation); * person.AddEvent(occupation); * } * break;*/ case ParsePersonState.Move: { person.AddEvent(DecodeEventType(eventString, IndividualEventClass.EventType.Immigration, true)); } break; case ParsePersonState.Source: { SourceDescriptionClass source = new SourceDescriptionClass(eventString); trace.TraceInformation("source " + eventString + " => " + source); person.AddSource(source); } break; case ParsePersonState.Lived: { person.AddEvent(DecodeEventType(eventString, IndividualEventClass.EventType.Residence, true)); } break; case ParsePersonState.Changed: { person.AddEvent(DecodeEventType(eventString, IndividualEventClass.EventType.RecordUpdate, true)); } break; case ParsePersonState.ChildFamily: { string familyId = ""; foreach (char ch in eventString) { if ((ch >= '0') && (ch <= '9') || (ch == ':')) { familyId += ch; } } string familyXref = xrefMapLists.GetMapper(XrefType.Family).GetXRef(familyId, false); person.AddRelation(new FamilyXrefClass(familyXref), IndividualClass.RelationType.Child); trace.TraceInformation("child in " + familyId + "=" + familyXref); FamilyClass family = familyTree.GetFamily(familyXref); if (family == null) { family = new FamilyClass(); family.SetXrefName(familyXref); } family.AddRelation(new IndividualXrefClass(person.GetXrefName()), FamilyClass.RelationType.Child); familyTree.AddFamily(family); } break; case ParsePersonState.SpouseFamily: { string familyId = ""; foreach (char ch in eventString) { if ((ch >= '0') && (ch <= '9') || (ch == ':')) { familyId += ch; } } string familyXref = xrefMapLists.GetMapper(XrefType.Family).GetXRef(familyId, false); person.AddRelation(new FamilyXrefClass(familyXref), IndividualClass.RelationType.Spouse); trace.TraceInformation("spouse in " + familyId + "=" + familyXref); FamilyClass family = familyTree.GetFamily(familyXref); if (family == null) { family = new FamilyClass(); family.SetXrefName(familyXref); } family.AddRelation(new IndividualXrefClass(person.GetXrefName()), FamilyClass.RelationType.Parent); familyTree.AddFamily(family); } break; } }
bool UpdateRelations(IDictionary <string, HttpPerson> personList, ref IndividualClass individual) { bool updated = false; foreach (KeyValuePair <string, HttpPerson> nodePersonPair in personList) { if ((nodePersonPair.Key.IndexOf("profile-") == 0) && (nodePersonPair.Key.Substring(8) == individual.GetXrefName())) { if (nodePersonPair.Value != null) { HttpPerson nodePerson = (HttpPerson)nodePersonPair.Value; /*if (nodePerson.edges != null) * { * foreach (KeyValuePair<string, HttpUnion> edgePair in nodePerson.edges) * { * if (edgePair.Value != null) * { * HttpUnion union = (HttpUnion)edgePair.Value; * * if (union.rel == "child") * { * individual.AddRelation(new FamilyXrefClass(edgePair.Key.Substring(6)), IndividualClass.RelationType.Child); * updated = true; * } * else if (union.rel == "partner") * { * individual.AddRelation(new FamilyXrefClass(edgePair.Key.Substring(6)), IndividualClass.RelationType.Spouse); * updated = true; * } * } * } * }*/ } } } return(updated); }
public IndividualClass GetIndividual(String xrefName, uint index = (uint)SelectIndex.NoIndex, PersonDetail detailLevel = PersonDetail.PersonDetail_All) { if (xrefName == null) { trace.TraceInformation("GetIndividual(root)"); rootPersonXref = FetchRootPerson(); xrefName = rootPersonXref; } if (xrefName == null) { trace.TraceInformation("GetIndividual(null)!!!" + DateTime.Now); return(null); } if (cache.individuals.ContainsKey(xrefName)) { if (printDecode) { trace.TraceInformation("GetIndividual(" + xrefName + ") cached"); } return(cache.individuals[xrefName]); } if (printDecode) { trace.TraceInformation("GetIndividual(" + xrefName + ") start " + DateTime.Now); } if (!authenticated) { Authenticate(); GetTreeStats(); } string sLine = null;; try { string sURL = "https://www.geni.com/api/profile-" + xrefName + "/immediate-family?only_ids=true&fields=first_name,middle_name,nicknames,last_name,maiden_name,gender,birth,death,id"; WebRequest wrGETURL; wrGETURL = WebRequest.Create(sURL); if (authenticationToken != null) { wrGETURL.Headers.Add("Authorization", String.Format("Bearer {0}", Uri.EscapeDataString(authenticationToken))); } if (printDecode) { trace.TraceInformation("GetIndividual(" + xrefName + ") = " + sURL + " " + DateTime.Now); } Stream objStream = wrGETURL.GetResponse().GetResponseStream(); StreamReader objReader = new StreamReader(objStream); sLine = objReader.ReadToEnd(); } catch { return(null); } if (sLine != null) { IndividualClass focusPerson; if (printDecode) { trace.TraceInformation("**********************************************************-start"); trace.TraceInformation("{0}:{1}", sLine.Length, sLine); trace.TraceInformation("**********************************************************-end"); } if ((sLine.StartsWith("<!DOCTYPE") || sLine.StartsWith("<HTML") || sLine.StartsWith("<html"))) { trace.TraceInformation("Bad format. Don't parse."); trace.TraceInformation("**********************************************************-start"); trace.TraceInformation("{0}:{1}", sLine.Length, sLine); trace.TraceInformation("**********************************************************-end"); return(null); } getIndividualResult = serializer.Deserialize <HttpGetIndividualResult>(sLine); if (getIndividualResult.focus != null) { focusPerson = DecodeIndividual(getIndividualResult.focus); if (focusPerson != null) { if (!UpdateRelations(getIndividualResult.nodes, ref focusPerson)) { if (printDecode) { trace.TraceInformation("focusperson added " + focusPerson.GetXrefName() + " no relation updates.."); } } cache.individuals.Add(focusPerson.GetXrefName(), focusPerson); } foreach (KeyValuePair <string, HttpPerson> nodePersonPair in getIndividualResult.nodes) { if (nodePersonPair.Key.IndexOf("profile-") == 0) { if (!cache.individuals.ContainsKey(nodePersonPair.Key.Substring(8))) { if (nodePersonPair.Value != null) { HttpPerson nodePerson = (HttpPerson)nodePersonPair.Value; IndividualClass nodeIndividual = DecodeIndividual(nodePerson); if (nodeIndividual != null) { if (printDecode) { trace.TraceInformation(" Cache person:" + nodePersonPair.Key.Substring(8) + "=" + nodeIndividual.GetName()); } if (!UpdateRelations(getIndividualResult.nodes, ref nodeIndividual)) { trace.TraceInformation(" Added " + nodeIndividual.GetXrefName() + " no relation updates.."); } /*if (printDecode) * { * nodeIndividual.Print(); * }*/ cache.individuals.Add(nodeIndividual.GetXrefName(), nodeIndividual); } } } else { if (printDecode) { trace.TraceInformation(" Person " + nodePersonPair.Key.Substring(8) + " skipped, already cached"); } } } } if (printDecode) { trace.TraceInformation("GetIndividual() done " + DateTime.Now); } return(focusPerson); } } return(null); }
private void ReadFile(ref FamilyTreeStoreBaseClass inFamilyTree, FamilyTreeStoreAnarkiv anarkivStore) { //IndividualClass person = anarkivStore.GetIndividual(); IEnumerator <IndividualClass> people = anarkivStore.SearchPerson(); AnarkivMappers mappers = new AnarkivMappers(inFamilyTree); IDictionary <string, XrefMapperClass> individualMapper = mappers.GetMapper(XrefType.Individual); IDictionary <string, XrefMapperClass> familyMapper = mappers.GetMapper(XrefType.Family); int counter = 0; while (people.MoveNext()) { IndividualClass person = people.Current; trace.TraceInformation("Person[" + counter++ + "]:" + person.GetPersonalName().ToString()); IndividualXrefClass xref = new IndividualXrefClass(inFamilyTree.CreateNewXref(XrefType.Individual)); individualMapper.Add(person.GetXrefName(), new XrefMapperClass(xref.GetXrefName(), true)); person.SetXrefName(xref.GetXrefName()); if (person.GetFamilyChildList() != null) { IList <FamilyXrefClass> newChildFamilies = new List <FamilyXrefClass>(); foreach (FamilyXrefClass childFamily in person.GetFamilyChildList()) { FamilyXrefClass newFamily = new FamilyXrefClass(mappers.GetLocalXRef(XrefType.Family, childFamily.GetXrefName())); newChildFamilies.Add(newFamily); } person.SetFamilyChildList(newChildFamilies); } if (person.GetFamilySpouseList() != null) { IList <FamilyXrefClass> newSpouseFamilies = new List <FamilyXrefClass>(); foreach (FamilyXrefClass spouseFamily in person.GetFamilySpouseList()) { FamilyXrefClass newFamily = new FamilyXrefClass(mappers.GetLocalXRef(XrefType.Family, spouseFamily.GetXrefName())); newSpouseFamilies.Add(newFamily); } person.SetFamilySpouseList(newSpouseFamilies); } inFamilyTree.AddIndividual(person); } IEnumerator <FamilyClass> familyEnumerator = anarkivStore.SearchFamily(); counter = 0; while (familyEnumerator.MoveNext()) { FamilyClass family = familyEnumerator.Current; FamilyClass newFamily = new FamilyClass(); trace.TraceInformation("Family[" + counter++ + "]:" + family.GetXrefName()); newFamily.SetXrefName(mappers.GetLocalXRef(XrefType.Family, family.GetXrefName(), true)); trace.TraceInformation("Family xref " + family.GetXrefName() + " ==> " + newFamily.GetXrefName()); if (family.GetParentList() != null) { //IList<IndividualXrefClass> newParentList = new List<IndividualXrefClass>(); foreach (IndividualXrefClass parent in family.GetParentList()) { IndividualXrefClass newParent = new IndividualXrefClass(mappers.GetLocalXRef(XrefType.Individual, parent.GetXrefName())); //newParentList.Add(newParent); newFamily.AddRelation(newParent, FamilyClass.RelationType.Parent); trace.TraceInformation(" add parent " + parent.GetXrefName() + " => " + newParent.GetXrefName()); } } if (family.GetChildList() != null) { //IList<IndividualXrefClass> newChildList = new List<IndividualXrefClass>(); foreach (IndividualXrefClass child in family.GetChildList()) { IndividualXrefClass newChild = new IndividualXrefClass(mappers.GetLocalXRef(XrefType.Individual, child.GetXrefName())); //newChildList.Add(newChild); newFamily.AddRelation(newChild, FamilyClass.RelationType.Child); trace.TraceInformation(" add child " + child.GetXrefName() + " => " + newChild.GetXrefName()); } } //family. inFamilyTree.AddFamily(newFamily); } }
public static void SearchDuplicates(IndividualClass person1, IFamilyTreeStoreBaseClass familyTree1, IFamilyTreeStoreBaseClass familyTree2, ReportCompareResult reportDuplicate, IProgressReporterInterface reporter = null, NameEquivalenceDb nameEqDb = null) { IndividualEventClass birth = person1.GetEvent(IndividualEventClass.EventType.Birth); IndividualEventClass death = person1.GetEvent(IndividualEventClass.EventType.Death); if (reporter != null) { trace.TraceInformation(reporter.ToString()); } if (((birth != null) && (birth.GetDate() != null) && (birth.GetDate().ValidDate())) || ((death != null) && (death.GetDate() != null) && (death.GetDate().ValidDate()))) { string searchString; if (familyTree2.GetCapabilities().jsonSearch) { searchString = SearchDescriptor.ToJson(SearchDescriptor.GetSearchDescriptor(person1)); } else { searchString = person1.GetName().Replace("*", ""); } IEnumerator <IndividualClass> iterator2 = familyTree2.SearchPerson(searchString); int cnt2 = 0; if (iterator2 != null) { int cnt3 = 0; do { IndividualClass person2 = iterator2.Current; if (person2 != null) { cnt3++; //trace.TraceInformation(reporter.ToString() + " 2:" + person2.GetName()); if ((familyTree1 != familyTree2) || (person1.GetXrefName() != person2.GetXrefName())) { if (ComparePerson(person1, person2, nameEqDb)) { trace.TraceData(TraceEventType.Information, 0, " 2:" + person2.GetName() + " " + person1.GetXrefName() + " " + person2.GetXrefName()); reportDuplicate(familyTree1, person1.GetXrefName(), familyTree2, person2.GetXrefName()); } cnt2++; } } } while (iterator2.MoveNext()); iterator2.Dispose(); trace.TraceInformation(" " + searchString + " matched with " + cnt2 + "," + cnt3); } if (cnt2 == 0) // No matches found for full name { if ((person1.GetPersonalName().GetName(PersonalNameClass.PartialNameType.BirthSurname).Length > 0) && (person1.GetPersonalName().GetName(PersonalNameClass.PartialNameType.Surname).Length > 0) && !person1.GetPersonalName().GetName(PersonalNameClass.PartialNameType.Surname).Equals(person1.GetPersonalName().GetName(PersonalNameClass.PartialNameType.BirthSurname))) { String strippedName = person1.GetName().Replace("*", ""); if (strippedName.Contains(person1.GetPersonalName().GetName(PersonalNameClass.PartialNameType.Surname))) { String maidenName = strippedName.Replace(person1.GetPersonalName().GetName(PersonalNameClass.PartialNameType.Surname), "").Replace(" ", " "); IEnumerator <IndividualClass> iterator3 = familyTree2.SearchPerson(maidenName); //trace.TraceInformation(" Searching Maiden name " + maidenName); if (iterator3 != null) { int cnt3 = 0; do { IndividualClass person2 = iterator3.Current; if (person2 != null) { if ((familyTree1 != familyTree2) || (person1.GetXrefName() != person2.GetXrefName())) { cnt3++; if (ComparePerson(person1, person2, nameEqDb)) { trace.TraceData(TraceEventType.Information, 0, " 2b:" + person2.GetName()); reportDuplicate(familyTree1, person1.GetXrefName(), familyTree2, person2.GetXrefName()); } } } } while (iterator3.MoveNext()); iterator3.Dispose(); trace.TraceInformation(" Maiden name " + maidenName + " mathched with " + cnt3); } } if (strippedName.Contains(person1.GetPersonalName().GetName(PersonalNameClass.PartialNameType.BirthSurname))) { String marriedName = strippedName.Replace(person1.GetPersonalName().GetName(PersonalNameClass.PartialNameType.BirthSurname), "").Replace(" ", " "); IEnumerator <IndividualClass> iterator3 = familyTree2.SearchPerson(marriedName); //trace.TraceInformation(" Searching Married name " + marriedName); if (iterator3 != null) { int cnt3 = 0; do { //IndividualClass person1 = iterator1.Current; IndividualClass person2 = iterator3.Current; if (person2 != null) { //trace.TraceInformation(reporter.ToString() + " 2:" + person2.GetName()); if ((familyTree1 != familyTree2) || (person1.GetXrefName() != person2.GetXrefName())) { cnt3++; if (ComparePerson(person1, person2, nameEqDb)) { trace.TraceData(TraceEventType.Information, 0, " 2c:" + person2.GetName()); reportDuplicate(familyTree1, person1.GetXrefName(), familyTree2, person2.GetXrefName()); } } } } while (iterator3.MoveNext()); iterator3.Dispose(); trace.TraceInformation(" Married name " + marriedName + " matched to " + cnt3); } } } } } else { trace.TraceData(TraceEventType.Information, 0, "No valid birth or death date for " + person1.GetName().ToString() + " skip duplicate search"); } }
public void AddToListView(ref ListView list, AncestorStatistics stats) { bool disableCounter = true; { resultList.Items.Clear(); if (stats != null) { IEnumerable <AncestorLineInfo> query = stats.GetAncestorList().OrderBy(ancestor => ancestor.depth); //SanityCheckLimits limits = GetSanitySettings(utility.GetCurrentDirectory() + "\\SanitySettings.fssan"); foreach (AncestorLineInfo root in query) { AddItemToListView(root, limits); } } } if (!disableCounter) { IEnumerable <HandledItem> query = stats.GetAnalysedPeopleNo().OrderByDescending(ancestor => ancestor.number); foreach (HandledItem item in query) { if (item.number > 1) { IndividualClass person = familyTree.GetIndividual(item.xref); if (person != null) { trace.TraceInformation(" Referenced " + item.number + " times: " + person.GetName() + " " + person.GetDate(IndividualEventClass.EventType.Birth) + " - " + person.GetDate(IndividualEventClass.EventType.Death) + " " + item.relationStackList.Count); //list.Add(new ListedPerson(" Multiply Referenced " + item.number + " times: " + person.GetName() + " " + person.GetDate(IndividualEventClass.EventType.Birth) + " - " + person.GetDate(IndividualEventClass.EventType.Death), person.GetXrefName())); ListViewItem lvItem = new ListViewItem(person.GetName()); lvItem.SubItems.AddRange(new string[] { "X:" + item.number, person.GetDate(IndividualEventClass.EventType.Birth).ToString(), person.GetDate(IndividualEventClass.EventType.Death).ToString(), "referenced " + item.number + " times" }); lvItem.Tag = person.GetXrefName(); lvItem.ToolTipText = ""; foreach (RelationStack stack in item.relationStackList) { if (stack != null) { lvItem.ToolTipText += stack.ToString(familyTree, false); lvItem.ToolTipText += "\n"; trace.TraceInformation(stack.ToString(familyTree, false)); } } list.Items.Add(lvItem); } else { trace.TraceInformation(" Person == null:" + item); } } } } /*{ * foreach (HandledItem item in analysedFamiliesNo) * { * if (item.number > 1) * { * trace.TraceInformation("Duplicate family " + item.number + " " + item.xref); * } * } * }*/ }
ListViewItem CreateListItem(FamilyTreeStoreBaseClass familyTree1, IndividualClass person1, FamilyTreeStoreBaseClass familyTree2, IndividualClass person2) { ListViewItem item = new ListViewItem(person1.GetName()); FamilyStatusClass.IndividualStatus status1 = FamilyStatusClass.CheckCorrectness(familyTree1, person1); FamilyStatusClass.IndividualStatus status2 = FamilyStatusClass.CheckCorrectness(familyTree2, person2); string str1 = GetShortFacts(status1); string str2 = GetShortFacts(status2); item.SubItems.AddRange(new string[] { person1.GetDate(IndividualEventClass.EventType.Birth).ToString(), person1.GetDate(IndividualEventClass.EventType.Death).ToString(), str1, person2.GetName(), person2.GetDate(IndividualEventClass.EventType.Birth).ToString(), person2.GetDate(IndividualEventClass.EventType.Death).ToString(), str2 }); trace.TraceInformation("match1:" + GetPersonString(person1, str1)); trace.TraceInformation("match2:" + GetPersonString(person2, str2)); item.UseItemStyleForSubItems = false; if (!person1.GetDate(IndividualEventClass.EventType.Birth).ToString().Equals(person2.GetDate(IndividualEventClass.EventType.Birth).ToString())) { //string checkChar = "Good birth"; int idx1 = 1; int idx2 = 5; if (status1.birthCorrectness == FamilyStatusClass.EventCorrectness.Perfect && status2.birthCorrectness != FamilyStatusClass.EventCorrectness.Perfect) { item.SubItems[idx1].BackColor = Color.LightGreen; item.SubItems[idx2].BackColor = Color.LightSalmon; } else if (status1.birthCorrectness != FamilyStatusClass.EventCorrectness.Perfect && status2.birthCorrectness == FamilyStatusClass.EventCorrectness.Perfect) { item.SubItems[idx1].BackColor = Color.LightSalmon; item.SubItems[idx2].BackColor = Color.LightGreen; } else { item.SubItems[idx1].BackColor = Color.Yellow; item.SubItems[idx2].BackColor = Color.Yellow; } } if (!person1.GetDate(IndividualEventClass.EventType.Death).ToString().Equals(person2.GetDate(IndividualEventClass.EventType.Death).ToString())) { int idx1 = 2; int idx2 = 6; if (status1.deathCorrectness == FamilyStatusClass.EventCorrectness.Perfect && status2.deathCorrectness != FamilyStatusClass.EventCorrectness.Perfect) { item.SubItems[idx1].BackColor = Color.LightGreen; item.SubItems[idx2].BackColor = Color.LightSalmon; } else if (status1.deathCorrectness != FamilyStatusClass.EventCorrectness.Perfect && status2.deathCorrectness == FamilyStatusClass.EventCorrectness.Perfect) { item.SubItems[idx1].BackColor = Color.LightSalmon; item.SubItems[idx2].BackColor = Color.LightGreen; } else { item.SubItems[idx1].BackColor = Color.Yellow; item.SubItems[idx2].BackColor = Color.Yellow; } } if (!str1.Equals(str2)) { item.SubItems[3].BackColor = Color.Yellow; item.SubItems[7].BackColor = Color.Yellow; //item.GetSubItemAt(2, 0).BackColor = Color.Blue; //item.GetSubItemAt(5, 0).BackColor = Color.Brown; } //item.Tag = person1.GetXrefName(); item.Tag = new DuplicateTreeItems(person1.GetXrefName(), person2.GetXrefName()); //matchListView1.Items.Add(item); return(item); }
public void AddRelative(RelativeType relation, IndividualClass person = null) { trace.TraceInformation("TreeViewPanel2::AddRelative " + relation); if (familyTree != null) { if (selectedIndividual != null) { IndividualClass newPerson; if (person != null) { newPerson = person; } else { newPerson = new IndividualClass(); } newPerson.SetXrefName(familyTree.CreateNewXref(XrefType.Individual)); if (relation == RelativeType.Parent) { FamilyXrefClass parentFamilyXref = null; FamilyClass parentFamily = null; IList <FamilyXrefClass> parents = selectedIndividual.GetFamilyChildList(); if (parents != null) { if (parents.Count > 0) { // ToDo: Full support for multiple families.. parentFamilyXref = parents[0]; parentFamily = familyTree.GetFamily(parentFamilyXref.GetXrefName()); } } if (parentFamilyXref == null) { parentFamilyXref = new FamilyXrefClass(familyTree.CreateNewXref(XrefType.Family)); //parentFamily.SetXrefName(); parentFamily = new FamilyClass(); parentFamily.SetXrefName(parentFamilyXref.GetXrefName()); parentFamily.AddRelation(new IndividualXrefClass(selectedIndividual.GetXrefName()), FamilyClass.RelationType.Child); selectedIndividual.AddRelation(parentFamilyXref, IndividualClass.RelationType.Child); familyTree.UpdateIndividual(selectedIndividual, PersonUpdateType.ChildFamily); } parentFamily.AddRelation(new IndividualXrefClass(newPerson.GetXrefName()), FamilyClass.RelationType.Parent); newPerson.AddRelation(parentFamilyXref, IndividualClass.RelationType.Spouse); familyTree.AddFamily(parentFamily); familyTree.AddIndividual(newPerson); } else if (relation == RelativeType.Child) { FamilyXrefClass childFamilyXref = null; FamilyClass childFamily = null; IList <FamilyXrefClass> children = selectedIndividual.GetFamilySpouseList(); if (children != null) { if (children.Count > 0) { // ToDo: Full support for multiple families.. childFamilyXref = children[0]; childFamily = familyTree.GetFamily(childFamilyXref.GetXrefName()); } } if (childFamilyXref == null) { childFamilyXref = new FamilyXrefClass(familyTree.CreateNewXref(XrefType.Family)); //parentFamily.SetXrefName(); childFamily = new FamilyClass(); childFamily.SetXrefName(childFamilyXref.GetXrefName()); childFamily.AddRelation(new IndividualXrefClass(selectedIndividual.GetXrefName()), FamilyClass.RelationType.Parent); selectedIndividual.AddRelation(childFamilyXref, IndividualClass.RelationType.Spouse); familyTree.UpdateIndividual(selectedIndividual, PersonUpdateType.SpouseFamily); } childFamily.AddRelation(new IndividualXrefClass(newPerson.GetXrefName()), FamilyClass.RelationType.Child); newPerson.AddRelation(childFamilyXref, IndividualClass.RelationType.Child); familyTree.AddFamily(childFamily); familyTree.AddIndividual(newPerson); } else // if (relation == RelativeType.Unrelated) { familyTree.AddIndividual(newPerson); } //familyTree.AddIndividual(newPerson); } ShowActiveFamily(); } }
private void ShowActiveFamily() { bool clear = false; trace.TraceInformation("ShowActiveFamily (start)"); if (!this.CanFocus) { trace.TraceInformation("ShowActiveFamily (end:hidden->shown=>refresh)"); return; } if (generationNoCtrl.SelectedItem == null) { trace.TraceInformation("ShowActiveFamily (selecteditem == null)"); return; } if (generationNoCtrl.SelectedItem.ToString() != layout.GetGenerations().ToString()) { layout.SetGenerations(Convert.ToInt32(generationNoCtrl.SelectedItem)); } if (!layout.IsEqual(prevLayout)) { //lastSize.Height = this.Height; //lastSize.Width = this.Width; //layout.Init(lastSize); //ClearButtonLayout(); clear = true; prevLayout = layout.Clone(); } if (selectedIndividual != null) { if ((prevSelectedIndividual == null) || (prevSelectedIndividual != selectedIndividual.GetXrefName())) { //ClearButtonLayout(); clear = true; //prevLayout = layout; prevSelectedIndividual = selectedIndividual.GetXrefName(); } if (clear) { ClearButtonLayout(); trace.TraceData(TraceEventType.Warning, 0, " scrollv:" + mainPanel.VerticalScroll.Value + " " + mainPanel.VerticalScroll.Maximum + " " + mainPanel.VerticalScroll.Minimum + " scrollh:" + mainPanel.HorizontalScroll.Value + " " + mainPanel.HorizontalScroll.Maximum + " " + mainPanel.HorizontalScroll.Minimum); mainPanel.Width += 100; mainPanel.Height += 100; mainPanel.VerticalScroll.Value = mainPanel.VerticalScroll.Maximum; mainPanel.HorizontalScroll.Value = mainPanel.HorizontalScroll.Maximum; trace.TraceData(TraceEventType.Warning, 0, " scrollv:" + mainPanel.VerticalScroll.Value + " " + mainPanel.VerticalScroll.Maximum + " " + mainPanel.VerticalScroll.Minimum + " scrollh:" + mainPanel.HorizontalScroll.Value + " " + mainPanel.HorizontalScroll.Maximum + " " + mainPanel.HorizontalScroll.Minimum); } if (!personControlList.ContainsKey(selectedIndividual.GetXrefName())) { IndividualButton selectedButton = new IndividualButton(selectedIndividual.GetXrefName(), selectedIndividual); selectedButton.SetParent(this); personControlList.Add(selectedIndividual.GetXrefName(), selectedButton); mainPanel.Controls.Add(selectedButton); } IndividualButton personControl = personControlList[selectedIndividual.GetXrefName()]; UpdateIndividual(selectedIndividual, layout, ref personControl); CheckLayout(selectedIndividual.GetXrefName(), false); } else { if (prevSelectedIndividual != null) { ClearButtonLayout(); prevSelectedIndividual = null; } } //Refresh(); trace.TraceInformation("ShowActiveFamily (end-done) "); }