Esempio n. 1
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. 2
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. 3
0
 private void cmdOK_Click(object sender, EventArgs e)
 {
     try
     {
         GEDFileEntry FE = (GEDFileEntry)lstItems.SelectedItem;
         if (FE != null)
         {
             mID = ((GEDFileEntry)lstItems.SelectedItem).ID;
         }
         else
         {
             mID = "";
         }
     }
     catch (Exception)
     {
         mID = "";
     }
     this.Close();
 }
Esempio n. 4
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. 5
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;
                }
            }
        }