void UpdateData() { string newText; if (individual != null) { newText = individual.GetName() + "\n" + individual.GetDate(IndividualEventClass.EventType.Birth).ToString() + " - " + individual.GetDate(IndividualEventClass.EventType.Death).ToString(); IndividualClass.IndividualSexType sex = individual.GetSex(); if (sex == IndividualClass.IndividualSexType.Female) { this.BackColor = Color.LightPink; } else if (sex == IndividualClass.IndividualSexType.Male) { this.BackColor = Color.LightBlue; } else if (sex == IndividualClass.IndividualSexType.Unknown) { this.BackColor = Color.LightGray; } } else { newText = xref + " ..."; } this.Text = newText; details.SetToolTip(this, CreateToolString()); }
public IndividualButton(IndividualClass individual, bool selected = false) { this.individual = individual; this.Text = individual.GetName() + "\n" + individual.GetDate(IndividualEventClass.EventType.Birth).ToString() + " - " + individual.GetDate(IndividualEventClass.EventType.Death).ToString(); details = new ToolTip(); //details.IsBalloon = true; FlatStyle = FlatStyle.Flat; AutoSize = true; Anchor = AnchorStyles.Left | AnchorStyles.Top; Click += new System.EventHandler(Clicked); this.MouseUp += IndividualButton_MouseUp; //BackColor = Color.Beige; //details.AutomaticDelay = 10000; details.AutoPopDelay = 600000; //string toolTip = ; details.SetToolTip(this, CreateToolString()); //details.ToolTipTitle = individual.GetName(); //details.ToolTipIcon = ToolTipIcon.Info; IndividualClass.IndividualSexType sex = individual.GetSex(); if (!selected) { if (sex == IndividualClass.IndividualSexType.Female) { this.BackColor = Color.LightPink; } else if (sex == IndividualClass.IndividualSexType.Male) { this.BackColor = Color.LightBlue; } else if (sex == IndividualClass.IndividualSexType.Unknown) { this.BackColor = Color.LightGray; } } }
private void GetPersonProperties(IndividualClass person) { if (propertyList != null) { propertyList[0].Value = person.GetPersonalName().GetName(PersonalNameClass.PartialNameType.GivenName); propertyList[1].Value = person.GetPersonalName().GetName(PersonalNameClass.PartialNameType.MiddleName); propertyList[2].Value = person.GetPersonalName().GetName(PersonalNameClass.PartialNameType.Surname); propertyList[3].Value = person.GetPersonalName().GetName(PersonalNameClass.PartialNameType.BirthSurname); propertyList[4].Value = person.GetPersonalName().GetName(PersonalNameClass.PartialNameType.NameString); propertyList[5].Value = person.GetPersonalName().GetName(PersonalNameClass.PartialNameType.PublicName); switch (person.GetSex()) { case IndividualClass.IndividualSexType.Female: propertyList[SexIndex].Value = PersonPropertySex.Female; break; case IndividualClass.IndividualSexType.Male: propertyList[SexIndex].Value = PersonPropertySex.Male; break; case IndividualClass.IndividualSexType.Unknown: propertyList[SexIndex].Value = PersonPropertySex.Unknown; break; } IList <IndividualEventClass> eventList = person.GetEventList(); if (eventList != null) { foreach (IndividualEventClass ev in eventList) { switch (ev.GetEventType()) { case IndividualEventClass.EventType.Birth: propertyList[BirthIndex].Value = ev.GetDate().ToDateTime(); propertyList[BirthIndex + 1].Value = ev.GetAddress(); trace.TraceInformation("Birth: " + ev.GetAddress() + " " + ev.GetPlace() + " " + ev.ToString()); break; case IndividualEventClass.EventType.Death: propertyList[DeathIndex].Value = ev.GetDate().ToDateTime(); propertyList[DeathIndex + 1].Value = ev.GetAddress(); trace.TraceInformation("Death: " + ev.GetAddress() + " " + ev.GetPlace() + " " + ev.ToString()); break; } } } if (propertyList[BirthIndex].Value == null) { propertyList[BirthIndex].Value = DateTime.MinValue; } if (propertyList[DeathIndex].Value == null) { propertyList[DeathIndex].Value = DateTime.MinValue; } } else { trace.TraceEvent(TraceEventType.Error, 0, "error no proplist"); } }
public void SetSelectedPerson(IndividualClass person) { trace.TraceInformation("SetSelectedPerson"); if (person != null) { selectedPerson = person; if (propertyList != null) { propertyList[0].Value = person.GetPersonalName().GetName(PersonalNameClass.PartialNameType.GivenName); propertyList[1].Value = person.GetPersonalName().GetName(PersonalNameClass.PartialNameType.MiddleName); propertyList[2].Value = person.GetPersonalName().GetName(PersonalNameClass.PartialNameType.Surname); propertyList[3].Value = person.GetPersonalName().GetName(PersonalNameClass.PartialNameType.BirthSurname); propertyList[4].Value = person.GetPersonalName().GetName(PersonalNameClass.PartialNameType.NameString); switch (person.GetSex()) { case IndividualClass.IndividualSexType.Female: propertyList[5].Value = PersonPropertySex.Female; break; case IndividualClass.IndividualSexType.Male: propertyList[5].Value = PersonPropertySex.Male; break; case IndividualClass.IndividualSexType.Unknown: propertyList[5].Value = PersonPropertySex.Unknown; break; } IList <IndividualEventClass> eventList = person.GetEventList(); if (eventList != null) { foreach (IndividualEventClass ev in eventList) { switch (ev.GetEventType()) { case IndividualEventClass.EventType.Birth: propertyList[6].Value = ev.GetDate().ToDateTime(); break; case IndividualEventClass.EventType.Death: propertyList[7].Value = ev.GetDate().ToDateTime(); break; } } } if (propertyList[6].Value == null) { propertyList[6].Value = DateTime.MinValue; } if (propertyList[7].Value == null) { propertyList[7].Value = DateTime.MinValue; } } else { trace.TraceEvent(TraceEventType.Error, 0, "error no proplist"); } } else { trace.TraceEvent(TraceEventType.Error, 0, "error no selected person"); } }