Exemplo n.º 1
0
        public void Add(GedcomObject indi)
        {
            var visualObject = new VisualObject {
                Id = indi.Id, GedcomObject = indi, Children = new List <VisualObject>(), Parents = new List <VisualObject>()
            };

            _visualObjects.Add(visualObject);
        }
Exemplo n.º 2
0
        public Shape Render(GedcomObject o, int x, int y)
        {
            if (o is Individual)
            {
                return(Render((Individual)o, ScaleX(x), ScaleY(y)));
            }

            if (o is Family)
            {
                return(Render((Family)o, ScaleX(x), ScaleY(y)));
            }
            throw new ArgumentException();
        }
Exemplo n.º 3
0
        private void familyTreeView_AfterSelect(object sender, TreeViewEventArgs e)
        {
            if (e.Node.Tag != null)
            {
                GedcomIndividual individual = (GedcomIndividual)e.Node.Tag;

                detailView.Items.Clear();

                detailView.Items.Add(new ListViewItem(new string[] { "Name", individual.Name.ToString() }));
                detailView.Items.Add(new ListViewItem(new string[] { "Geschlecht", individual.Sex.ToString().ToLower() == "f" ? "W" : "M" }));

                if (!string.IsNullOrEmpty(individual.Email?.Content))
                {
                    detailView.Items.Add(new ListViewItem(new string[] { "E-Mail", individual.Email?.ToString() }));
                }

                DateTime birthDate = new DateTime();
                if (DateTime.TryParse(individual.Birth?.Date?.Content, out birthDate))
                {
                    detailView.Items.Add(new ListViewItem(new string[] { "Geburt", birthDate.ToShortDateString() }));
                }

                DateTime deathDate = new DateTime();
                if (DateTime.TryParse(individual.Death?.Date?.Content, out deathDate))
                {
                    detailView.Items.Add(new ListViewItem(new string[] { "Tod", deathDate.ToShortDateString() }));
                }

                detailView.AlternateHighlightRows();
                detailView.AutoResizeColumns(ColumnHeaderAutoResizeStyle.ColumnContent);

                if (individual.Objects.Count > 0)
                {
                    GedcomObject gedcomObject = individual.Objects.Where(p => p.Form.Content.StartsWith("image/")).FirstOrDefault();

                    if (gedcomObject != null && !string.IsNullOrEmpty(gedcomObject.File?.Content))
                    {
                        pictureBox1.ImageLocation = gedcomObject.File?.Content;
                        pictureBox1.Tag           = new Tuple <string, string>(gedcomObject.Form.Content, gedcomObject.File?.Content);
                    }
                }
                else
                {
                    pictureBox1.ImageLocation = string.Empty;
                }
            }
        }