Esempio n. 1
0
        private void cmdWife_Click(object sender, EventArgs e)
        {
            ItemPicker IP = new ItemPicker();
            string     ID;
            XmlNode    tmpNode;

            if (lblWife.Tag == null)
            {
                ID = IP.ShowDialogAndReturnString("", "INDI");
            }
            else
            {
                ID = IP.ShowDialogAndReturnString(lblWife.Tag.ToString(), "INDI");
            }

            if (ID != "")
            {
                tmpNode = GEDXMLUtilites.GlobalLocateNodeByID(ID, "INDI", MyNode);
                if (tmpNode != null)
                {
                    GEDFileEntryIndi Wife = new GEDFileEntryIndi();
                    Wife.Node    = tmpNode;
                    lblWife.Text = Wife.DisplayName;
                    lblWife.Tag  = ID;
                }
            }
            else
            {
                lblWife.Text = "";
                lblWife.Tag  = "";
            }
        }
Esempio n. 2
0
        private void cmdSource_Click(object sender, EventArgs e)
        {
            ItemPicker IP = new ItemPicker();
            string     ID;
            XmlNode    tmpNode;

            if (Source == null)
            {
                ID = IP.ShowDialogAndReturnString("", "SOUR");
            }
            else
            {
                ID = IP.ShowDialogAndReturnString(Source.ID, "SOUR");
            }

            if (ID != "")
            {
                tmpNode = GEDXMLUtilites.GlobalLocateNodeByID(ID, "SOUR", MyNode);
                if (tmpNode != null)
                {
                    Source         = new GEDFileEntrySour();
                    Source.Node    = tmpNode;
                    lblSource.Text = Source.DisplayName;
                }
            }
        }
Esempio n. 3
0
        private void ParseNodeToUIComponents(XmlNode Node)
        {
            XmlNode tmpNode;
            string  sID;

            foreach (XmlNode Child in Node.ChildNodes)
            {
                switch (Child.Name.ToUpper())
                {
                case "HUSB":
                    sID     = Child.Attributes["REF"].Value;
                    tmpNode = GEDXMLUtilites.GlobalLocateNodeByID(sID, "INDI", Child);
                    if (tmpNode != null)
                    {
                        GEDFileEntryIndi Husb = new GEDFileEntryIndi();
                        Husb.Node       = tmpNode;
                        lblHusband.Text = Husb.DisplayName;
                        lblHusband.Tag  = sID;
                    }
                    break;

                case "WIFE":
                    sID     = Child.Attributes["REF"].Value;
                    tmpNode = GEDXMLUtilites.GlobalLocateNodeByID(sID, "INDI", Child);
                    if (tmpNode != null)
                    {
                        GEDFileEntryIndi Wife = new GEDFileEntryIndi();
                        Wife.Node    = tmpNode;
                        lblWife.Text = Wife.DisplayName;
                        lblWife.Tag  = sID;
                    }
                    break;

                case "CHIL":
                    sID     = Child.Attributes["REF"].Value;
                    tmpNode = GEDXMLUtilites.GlobalLocateNodeByID(sID, "INDI", Child);
                    if (tmpNode != null)
                    {
                        GEDFileEntryIndi Chil = new GEDFileEntryIndi();
                        Chil.Node = tmpNode;
                        lstChildren.Items.Add(Chil);
                    }
                    break;

                case "MARR":
                    GEDXMLUtilites.ParseCompoundDate(Child, mdpMarriage);
                    break;

                case "DIV":
                    GEDXMLUtilites.ParseCompoundDate(Child, mdpDivorce);
                    break;

                default:
                    break;
                }
            }
        }
Esempio n. 4
0
        public GEDFileEntry NewEntry(string Type, XmlDocument Doc)
        {
            GEDFileEntry Entry   = null;
            String       sIDCode = "";

            switch (Type)
            {
            case "HEAD":
                Entry   = new GEDFileEntryHead();
                sIDCode = "X";
                break;

            case "SUBM":
                Entry   = new GEDFileEntrySubm();
                sIDCode = "SUB";
                break;

            case "INDI":
                Entry   = new GEDFileEntryIndi();
                sIDCode = "I";
                break;

            case "FAM":
                Entry   = new GEDFileEntryFam();
                sIDCode = "F";
                break;

            case "SOUR":
                Entry   = new GEDFileEntrySour();
                sIDCode = "S";
                break;

            default:
                frmGEDXmlEditor.Log("Node type not recognised: " + Type);
                break;
            }
            if (Entry != null)
            {
                XmlNode Node;
                Node = Doc.CreateElement(Type);
                // Everything will fall apart if we create an element with no ID
                GEDXMLUtilites.SetAttribute("ID", GetNextID(sIDCode), Node);
                Doc.DocumentElement.AppendChild(Node);
                Entry.Node = Node;
                Entries.Add(Entry);
            }

            return(Entry);
        }
Esempio n. 5
0
 static public XmlNode UpdateCompoundDateField(string Field, MyDatePicker DatePicker, XmlNode Node)
 {
     if (DatePicker.Checked)
     {
         XmlNode TmpNode = GEDXMLUtilites.UpdateSingleField(Field, GEDXMLUtilites.InsertEmpty, Node);
         GEDXMLUtilites.UpdateSingleField("DATE", DatePicker.Date.MedString(), TmpNode);
         GEDXMLUtilites.UpdateSingleField("PLAC", DatePicker.Place, TmpNode);
         GEDXMLUtilites.UpdateSingleField("NOTE", DatePicker.Note, TmpNode);
         return(TmpNode);
     }
     else
     {
         return(GEDXMLUtilites.UpdateSingleField(Field, "", Node));
     }
 }
Esempio n. 6
0
        static public void ParseCompoundDate(XmlNode Child, MyDatePicker Picker)
        {
            MyDate tmpDateTime;

            tmpDateTime = GEDXMLUtilites.ParseDate(Child);
            if (tmpDateTime != MyDate.MinValue)
            {
                Picker.Checked = true;
                Picker.Date    = tmpDateTime;
            }
            else
            {
                Picker.Checked = false;
            }
            Picker.Place = GEDXMLUtilites.ParsePlace(Child);
            Picker.Note  = GEDXMLUtilites.ParseNote(Child);
        }
Esempio n. 7
0
        private void cmdAddChild_Click(object sender, EventArgs e)
        {
            ItemPicker IP = new ItemPicker();
            string     ID;
            XmlNode    tmpNode;

            ID = IP.ShowDialogAndReturnString("", "INDI");

            if (ID != "")
            {
                tmpNode = GEDXMLUtilites.GlobalLocateNodeByID(ID, "INDI", MyNode);
                if (tmpNode != null)
                {
                    GEDFileEntryIndi Chil = new GEDFileEntryIndi();
                    Chil.Node = tmpNode;
                    lstChildren.Items.Add(Chil);
                }
            }
        }
Esempio n. 8
0
        void UpdateAllFields(XmlNode Node)
        {
            XmlNode TmpNode;

            GEDXMLUtilites.UpdateSingleField("NAME", txtName.Text, Node);
            if (rdoMale.Checked)
            {
                GEDXMLUtilites.UpdateSingleField("SEX", "M", Node);
            }
            else
            {
                GEDXMLUtilites.UpdateSingleField("SEX", "F", Node);
            }

            GEDXMLUtilites.UpdateCompoundDateField("BIRT", mdpBirth, Node);
            GEDXMLUtilites.UpdateCompoundDateField("DEAT", mdpDeath, Node);

            if (txtAKA.Text != "")
            {
                TmpNode = GEDXMLUtilites.UpdateSingleField("EVEN", txtAKA.Text, Node);
                GEDXMLUtilites.UpdateSingleField("TYPE", "AKA", TmpNode);
            }
            GEDXMLUtilites.UpdateSingleField("IMG", txtImage.Text, Node);
            GEDXMLUtilites.UpdateSingleField("NOTE", Note, Node);

            if (Source != null)
            {
                TmpNode = GEDXMLUtilites.UpdateSingleField("SOUR", GEDXMLUtilites.InsertEmpty, Node);
                GEDXMLUtilites.SetAttribute("REF", Source.ID, TmpNode);
            }

            //case "EMIG":
            //    break;
            //case "OCCU":
            //    break;
        }
Esempio n. 9
0
        void UpdateAllFields(XmlNode Node)
        {
            XmlNode TmpNode;

            GEDXMLUtilites.UpdateCompoundDateField("MARR", mdpMarriage, Node);
            GEDXMLUtilites.UpdateCompoundDateField("DIV", mdpDivorce, Node);

            if (lblHusband.Text != "")
            {
                TmpNode = GEDXMLUtilites.UpdateSingleField("HUSB", GEDXMLUtilites.InsertEmpty, Node);
                GEDXMLUtilites.SetAttribute("REF", lblHusband.Tag.ToString(), TmpNode);
            }
            else
            {
                GEDXMLUtilites.UpdateSingleField("HUSB", "", Node);
            }

            if (lblWife.Text != "")
            {
                TmpNode = GEDXMLUtilites.UpdateSingleField("WIFE", GEDXMLUtilites.InsertEmpty, Node);
                GEDXMLUtilites.SetAttribute("REF", lblWife.Tag.ToString(), TmpNode);
            }
            else
            {
                GEDXMLUtilites.UpdateSingleField("WIFE", "", Node);
            }

            // Children...
            string[] ChildIDs = new string[lstChildren.Items.Count];

            for (int i = 0; i < lstChildren.Items.Count; i++)
            {
                ChildIDs[i] = ((GEDFileEntryIndi)lstChildren.Items[i]).ID;
            }
            GEDXMLUtilites.UpdateMultipleFieldAttr("CHIL", "REF", ChildIDs, Node);

            // And now make sure the various individuals are linked back...
            XmlNode tmpIndiNode;
            string  MyID;

            MyID = Node.Attributes["ID"].Value;

            foreach (XmlNode Child in Node.ChildNodes)
            {
                try
                {
                    string SourceID = Child.Attributes["REF"].Value;
                    TmpNode = GEDXMLUtilites.GlobalLocateNodeByID(SourceID, "INDI", Child);
                    if (TmpNode != null)
                    {
                        if (Child.Name.ToUpper() == "HUSB" || Child.Name.ToUpper() == "WIFE")
                        {
                            tmpIndiNode = GEDXMLUtilites.UpdateSingleField("FAMS", GEDXMLUtilites.InsertEmpty, TmpNode);
                            GEDXMLUtilites.SetAttribute("REF", MyID, tmpIndiNode);
                        }
                        else if (Child.Name.ToUpper() == "CHIL")
                        {
                            tmpIndiNode = GEDXMLUtilites.UpdateSingleField("FAMC", GEDXMLUtilites.InsertEmpty, TmpNode);
                            GEDXMLUtilites.SetAttribute("REF", MyID, tmpIndiNode);
                        }
                    }
                }
                catch (Exception) { }
            }
        }
Esempio n. 10
0
        private void ParseNodeToUIComponents(XmlNode Node)
        {
            XmlNode tmpNode;

            pictureBox1.Image = pictureBox1.ErrorImage;

            foreach (XmlNode Child in Node.ChildNodes)
            {
                switch (Child.Name.ToUpper())
                {
                case "NAME":
                    txtName.Text = Child.InnerText.Trim();
                    break;

                case "SEX":
                    if (Child.InnerText == "M")
                    {
                        rdoMale.Checked = true;
                    }
                    else
                    {
                        rdoFemale.Checked = true;
                    }
                    break;

                case "BIRT":
                    GEDXMLUtilites.ParseCompoundDate(Child, mdpBirth);
                    break;

                case "DEAT":
                    GEDXMLUtilites.ParseCompoundDate(Child, mdpDeath);
                    break;

                case "EVEN":
                    txtAKA.Text = GEDXMLUtilites.ParseText(Child);
                    break;

                case "IMG":
                    txtImage.Text = Child.InnerText;
                    if (!LoadImage(txtImage.Text))
                    {
                        txtImage.Text = "";
                    }
                    break;

                case "NOTE":
                    Note = Child.InnerText;
                    break;

                case "SOUR":
                    try
                    {
                        string SourceID = Child.Attributes["REF"].Value;
                        tmpNode = GEDXMLUtilites.GlobalLocateNodeByID(SourceID, "SOUR", Child);
                        if (tmpNode != null)
                        {
                            Source         = new GEDFileEntrySour();
                            Source.Node    = tmpNode;
                            lblSource.Text = Source.DisplayName;
                        }
                    } catch (Exception) {}
                    break;

                case "EMIG":
                    break;

                case "OCCU":
                    break;

                default:
                    break;
                }
            }
        }
Esempio n. 11
0
        public void ResolveXrefs()
        {
            XmlNode tmpNode;

            foreach (XmlNode Child in pNode.ChildNodes)
            {
                switch (Child.Name.ToUpper())
                {
                case "HUSB":
                    try
                    {
                        string SourceID = Child.Attributes["REF"].Value;
                        tmpNode = GEDXMLUtilites.GlobalLocateNodeByID(SourceID, "INDI", Child);
                        if (tmpNode != null)
                        {
                            Husb      = new GEDFileEntryIndi();
                            Husb.Node = tmpNode;
                        }
                    }
                    catch (Exception) { }
                    break;

                case "WIFE":
                    try
                    {
                        string SourceID = Child.Attributes["REF"].Value;
                        tmpNode = GEDXMLUtilites.GlobalLocateNodeByID(SourceID, "INDI", Child);
                        if (tmpNode != null)
                        {
                            Wife      = new GEDFileEntryIndi();
                            Wife.Node = tmpNode;
                        }
                    }
                    catch (Exception) { }
                    break;

                default:
                    break;
                }
            }
            if (Husb != null)
            {
                if (Wife != null)
                {
                    DisplayName = Husb.DisplayName + " + " + Wife.DisplayName;
                }
                else
                {
                    DisplayName = Husb.DisplayName + " + ?";
                }
            }
            else
            {
                if (Wife != null)
                {
                    DisplayName = "? + " + Wife.DisplayName;
                }
                else
                {
                    DisplayName = "? + ?" + ID;
                }
            }
        }