Beispiel #1
0
        /// <summary>
        /// Reset the trees for the next analysis
        /// </summary>
        /// <param name="a"></param>
        /// <returns></returns>
        private TreeNode Reset(OldPerson a)
        {
            var result = new TreeNode {Text = "Ancestor", Name = "Parent_" + a.Id, BackColor = colorList[0]};

            treeView1.Nodes.Clear();
            treeView1.Nodes.Add(result);
             treeViewFamilies.Nodes.Clear();
            var item = new TreeNode {Text = a.Name + " Family Tree", Tag = a,
                BackColor = colorList[0]};
             treeViewFamilies.Nodes.Add(item);
            return result;
        }
 public void XFillPeopleList()
 {
     PeopleList.Clear();
     idList.Clear();
     var nodes = dom.SelectNodes("//person[@id]");
     if (nodes != null)
         foreach (XmlNode node in nodes)
         {
             var p = new OldPerson(node);
             PeopleList.Add(p);
             idList.Add(p.Id);
         }
 }
 public int StepsBetween(OldPerson a, string b)
 {
     if (a == null || b == null)
         return 0;
     return a.GetSteps(b);
 }
 public int StepsBetween(OldPerson a, OldPerson b)
 {
     if (a == null || b == null)
         return 0;
     return StepsBetween(a.Id, b.Id);
 }
 public bool AreSiblings(OldPerson a, OldPerson b)
 {
     var cms= a.GetCm(b.Id);
     return cms > 1800 && cms < 3700;
 }
        public bool AddPerson(OldPerson person)
        {
            if (null == FindPersonById(person.Id))
            {
                PeopleList.Add(person);
            }
            var node = dom.SelectSingleNode("//person[@id='" + person.Id + "']");
            if (node == null)
            {
                if (!idList.Contains(person.Id))
                {
                    idList.Add(person.Id);

                }
                dom.DocumentElement.AppendChild(person.GetNode(dom));
                return true;
            }
            return false;
        }