Esempio n. 1
0
            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();
            }
Esempio n. 2
0
            private void ReportMatchingProfiles(FamilyTreeStoreBaseClass familyTree1, string person1, FamilyTreeStoreBaseClass familyTree2, string person2)
            {
                IndividualClass person1full = familyTree1.GetIndividual(person1);
                IndividualClass person2full = familyTree2.GetIndividual(person2);

                resultReporterFunction(CreateListItem(familyTree1, person1full, familyTree2, person2full));
            }
 public void SetSelectedIndividual(String xrefName)
 {
     trace.TraceInformation("RelationFinderPanel::SetSelectedIndividual(" + xrefName + ")");
     if (familyTree != null)
     {
         selectedIndividual = (IndividualClass)familyTree.GetIndividual(xrefName);
     }
 }
Esempio n. 4
0
 private void ConnectPanelsToTree(FamilyTreeStoreBaseClass tree)
 {
     foreach (TreeViewPanelBaseClass panel in panelList)
     {
         panel.SetFamilyTree(tree);
     }
     if (tree.GetIndividual() != null)
     {
         foreach (TreeViewPanelBaseClass panel in panelList)
         {
             panel.OnSelectedPersonChangedEvent(this, new PersonChangeEvent(tree.GetIndividual()));
             //panel.SetSelectedIndividual(tree.GetIndividual().GetXrefName());
         }
     }
     else
     {
         trace.TraceEvent(TraceEventType.Error, 0, "  Error: GetIndividual(first) == null! " + DateTime.Now);
     }
 }
Esempio n. 5
0
        public void SetSelectedIndividual(String xrefName)
        {
            trace.TraceInformation("FamilyForm2::SetSelectedIndividual(" + xrefName + ")");
            selectedIndividual = (IndividualClass)familyTree.GetIndividual(xrefName);

            if (SelectedPersonChanged != null)
            {
                SelectedPersonChanged(this, new PersonChangeEvent(selectedIndividual));
            }

            if (familyTree != null)
            {
                toolStripStatusLabel1.Text = familyTree.GetShortTreeInfo();// "I:" + familyTree.individualList.Count + " F:" + familyTree.familyList.Count + " N:" + familyTree.noteList.Count;
            }
        }
Esempio n. 6
0
        void resultList_SelectedIndexChanged(object sender, EventArgs e)
        {
            trace.TraceInformation("ComparePanel1::resultList_SelectedIndexChanged()" + sender.ToString() + e.ToString());
            if (resultList.SelectedIndices.Count > 0)
            {
                trace.TraceInformation("ComparePanel1::resultList_SelectedIndexChanged()" + sender.ToString() + e.ToString() + " " + resultList.SelectedIndices.Count);

                foreach (ListViewItem item in resultList.SelectedItems)
                {
                    //item.
                    trace.TraceInformation(" selected: " + familyTree.GetIndividual(item.Tag.ToString()));

                    if (parentForm != null)
                    {
                        parentForm.SetSelectedIndividual(item.Tag.ToString());
                    }
                }
            }
        }
Esempio n. 7
0
        private void ShowActiveFamily()
        {
            trace.TraceInformation("TreeViewPanel2::ShowActiveFamily (start) " + this.CanFocus);

            while (controlList.Count > 0)
            {
                Control ctrl = controlList[0];

                this.Controls.Remove(ctrl);
                ctrl.Dispose();

                controlList.RemoveAt(0);
            }

            if (selectedIndividual != null)
            {
                Point position = new Point(0, 0);

                int ctrlHeight = 0;
                IDictionary <string, Point> familyPosition = new Dictionary <string, Point>();

                {
                    IList <FamilyXrefClass> children = selectedIndividual.GetFamilyChildList();

                    if (children != null)
                    {
                        trace.TraceInformation(" selected->parentFamilies.count = " + children.Count);
                        foreach (FamilyXrefClass childXref in children)
                        {
                            FamilyClass childFamily = new FamilyClass();
                            childFamily = familyTree.GetFamily(childXref.GetXrefName());

                            if (childFamily != null)
                            {
                                trace.TraceInformation(" selected->parentFamily:" + childFamily.GetXrefName());
                                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(parent);

                                            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;
                                            //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.MouseEnter += MouseEntered;
                                            //ctrl2.MouseLeave += MouseLeft;

                                            controlList.Add(ctrl2);

                                            this.Controls.Add(ctrl2);

                                            position.X += ctrl2.Width + 10;

                                            ctrlHeight = ctrl2.Height;
                                        }
                                        else
                                        {
                                            trace.TraceInformation("Error not a vaild person xref:" + parentXref.GetXrefName());
                                        }
                                    }
                                }
                            }
                            else
                            {
                                trace.TraceInformation("Error not a vaild person xref:" + childXref.GetXrefName());
                            }
                        }
                    }
                    else
                    {
                        trace.TraceInformation("selected->Children null ");
                    }
                }

                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(selectedIndividual, true);

                    //ctrl.AutoSize = true;
                    ctrl.Left = position.X;
                    ctrl.Top  = position.Y;

                    //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.MouseEnter += new System.EventHandler(MouseEntered);
                    //ctrl.MouseLeave += new System.EventHandler(MouseLeft);
                    //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 + 10;

                    ctrlHeight = ctrl.Height;
                }

                {
                    IList <FamilyXrefClass> spouseList = selectedIndividual.GetFamilySpouseList();

                    if (spouseList != null)
                    {
                        trace.TraceInformation(" selected->spouseFamily->count:" + spouseList.Count);
                        foreach (FamilyXrefClass spouseFamilyXref in spouseList)
                        {
                            FamilyClass spouseFamily = new FamilyClass();
                            spouseFamily = familyTree.GetFamily(spouseFamilyXref.GetXrefName());

                            if (spouseFamily != null)
                            {
                                trace.TraceInformation(" selected->spouseFamily:" + spouseFamily.GetXrefName());
                                if (!familyPosition.ContainsKey(spouseFamily.GetXrefName()))
                                {
                                    Point famPos = new Point(position.X - 20, position.Y + ctrlHeight);
                                    familyPosition.Add(spouseFamilyXref.GetXrefName(), famPos);
                                    trace.TraceInformation(" selected->spouseFamily Add:" + famPos.X + "," + famPos.Y);
                                }
                                IList <IndividualXrefClass> spouseParentList = spouseFamily.GetParentList();

                                if (spouseParentList != null)
                                {
                                    foreach (IndividualXrefClass spouseXref in spouseParentList)
                                    {
                                        if (spouseXref.GetXrefName() != selectedIndividual.GetXrefName())
                                        {
                                            IndividualClass spouse = new IndividualClass();

                                            spouse = familyTree.GetIndividual(spouseXref.GetXrefName());

                                            if (spouse != null)
                                            {
                                                IndividualButton ctrl2 = new IndividualButton(spouse);
                                                //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);
                                                //ctrl2.MouseEnter += MouseEntered;
                                                //ctrl2.MouseLeave += MouseLeft;

                                                controlList.Add(ctrl2);

                                                this.Controls.Add(ctrl2);

                                                position.X += ctrl2.Width + 10;
                                                ctrlHeight  = ctrl2.Height;
                                                trace.TraceInformation(" spouse: AddControl:" + spouse.GetName() + " X:" + position.X + " Y:" + position.Y + " Top:" + ctrl2.Top + " Height:" + ctrl2.Height);
                                            }
                                            else
                                            {
                                                trace.TraceEvent(TraceEventType.Error, 0, "Error not a vaild person xref:" + spouseXref.GetXrefName());
                                            }
                                        }
                                    }
                                }
                            }
                            else
                            {
                                trace.TraceEvent(TraceEventType.Error, 0, "Error not a vaild family xref:" + spouseFamilyXref.GetXrefName());
                            }
                        }
                        if (spouseList != null)
                        {
                            foreach (FamilyXrefClass family in spouseList)
                            {
                                FamilyClass familyObject = familyTree.GetFamily(family.GetXrefName());

                                if (familyObject != null)
                                {
                                    IList <IndividualXrefClass> childXrefList = familyTree.GetFamily(family.GetXrefName()).GetChildList();

                                    if (childXrefList != null)
                                    {
                                        trace.TraceInformation(" selectedFamily->childFamily:" + family.GetXrefName() + " children.count:" + childXrefList.Count);
                                        {
                                            Label label = new Label();

                                            Point childPosition = familyPosition[family.GetXrefName()];

                                            label.Top      = childPosition.Y;
                                            label.Left     = childPosition.X;
                                            label.Text     = "Children:" + childXrefList.Count;
                                            label.AutoSize = true;

                                            this.Controls.Add(label);
                                            controlList.Add(label);

                                            childPosition.Y += label.Height;
                                            familyPosition[family.GetXrefName()] = childPosition;
                                        }
                                        foreach (IndividualXrefClass childXref in childXrefList)
                                        {
                                            IndividualClass child = new IndividualClass();

                                            child = familyTree.GetIndividual(childXref.GetXrefName());

                                            if (child != null)
                                            {
                                                IndividualButton ctrl2 = new IndividualButton(child);

                                                ctrl2.AutoSize = true;
                                                Point childPosition = familyPosition[family.GetXrefName()];
                                                ctrl2.Left      = childPosition.X;
                                                ctrl2.Top       = childPosition.Y;
                                                ctrl2.FlatStyle = FlatStyle.Flat;
                                                ctrl2.Click    += new System.EventHandler(ctrl2.Clicked);
                                                //ctrl2.MouseEnter += MouseEntered;
                                                //ctrl2.MouseLeave += MouseLeft;

                                                //ctrl2.Text = child.GetName() + "\n" + child.GetDate(IndividualEventClass.EventType.Birth).ToString() + " - " + child.GetDate(IndividualEventClass.EventType.Death).ToString();
                                                ctrl2.individual = child;
                                                ctrl2.SetParent(this);

                                                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);

                                                childPosition.Y += ctrl2.Height;
                                                familyPosition[family.GetXrefName()] = childPosition;
                                                ctrlHeight += ctrl2.Height;
                                            }
                                        }
                                    }
                                    else
                                    {
                                        trace.TraceInformation(" selectedFamily->childFamily:" + family.GetXrefName() + " children null");
                                    }
                                }
                                else
                                {
                                    trace.TraceInformation(" selectedFamily:" + family.GetXrefName() + " null");
                                }
                            }
                        }
                    }
                    else
                    {
                        trace.TraceInformation(" selected->spouseFamily null");
                    }
                }
            }
            this.Top  = 0;
            this.Left = 0;

            this.Width  = 600;
            this.Height = 600;


            //this.Show();
            trace.TraceInformation("TreeViewPanel2::ShowActiveFamily (end) ");
        }
Esempio n. 8
0
        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) ");
        }
Esempio n. 9
0
        private void AddPerson(IndividualClass person, Point position, int generation)
        {
            Point            size       = new Point(controlWidth, controlHeight);
            IndividualButton individual = new IndividualButton(this, person, size, boxFont);

            individual.Top  = position.Y;
            individual.Left = position.X;


            this.controlList.Add(individual);
            this.Controls.Add(individual);

            /*if (individual.Width > controlWidth)
             * {
             * individual.Width = controlWidth;
             * }*/

            if (generation < maxGenerations)
            {
                IList <FamilyXrefClass> parentFamilies = individual.individual.GetFamilyChildList();

                if (parentFamilies != null)
                {
                    foreach (FamilyXrefClass familyXref in parentFamilies)
                    {
                        FamilyClass family = familyTree.GetFamily(familyXref.GetXrefName());

                        if (family != null)
                        {
                            IList <IndividualXrefClass> parentXrefList = family.GetParentList();

                            if (parentXrefList != null)
                            {
                                Point nextPosition  = position;
                                int   margin        = controlMargin;
                                int   controlOffset = (controlHeight + margin) * (int)Math.Pow((double)2, (double)(maxGenerations - generation - 1));

                                //if(generation == 0)
                                {
                                    //margin += controlHeight / 2;
                                }

                                if (controlOffset > controlHeight)
                                {
                                    nextPosition.X += controlWidth + margin;
                                }

                                /*else
                                 * {
                                 * nextPosition.X += controlWidthSmall + margin;
                                 * }*/
                                nextPosition.Y -= controlOffset / 2;

                                foreach (IndividualXrefClass parentXref in parentXrefList)
                                {
                                    IndividualClass parent = familyTree.GetIndividual(parentXref.GetXrefName());

                                    if (parent != null)
                                    {
                                        AddPerson(parent, nextPosition, generation + 1);
                                    }
                                    nextPosition.Y += controlOffset;
                                }
                            }
                        }
                    }
                }
            }
        }