コード例 #1
0
        void SaveListConents()
        {
            SaveFileDialog fileDlg = new SaveFileDialog();

            fileDlg.Filter           = "Compare List|*.fsc";
            fileDlg.InitialDirectory = utility.GetCurrentDirectory();

            if (fileDlg.ShowDialog(this) == System.Windows.Forms.DialogResult.OK)
            {
                FileStream saveList = new FileStream(fileDlg.FileName, FileMode.Create);

                SavedMatches           savedMatches = new SavedMatches();
                DataContractSerializer serializer   = new DataContractSerializer(typeof(SavedMatches));

                savedMatches.database1 = selectedForm1.Text;
                savedMatches.database2 = selectedForm2.Text;
                foreach (ListViewItem item in matchListView1.Items)
                {
                    DuplicateTreeItems matchingPersons = (DuplicateTreeItems)item.Tag;

                    savedMatches.itemList.Add(matchingPersons);
                }

                serializer.WriteObject(saveList, savedMatches);
                saveList.Close();
            }
        }
コード例 #2
0
 void matchListView1_SelectedIndexChanged(object sender, EventArgs e)
 {
     foreach (ListViewItem item in matchListView1.SelectedItems)
     {
         DuplicateTreeItems items = (DuplicateTreeItems)item.Tag;
         if (selectedForm1 != null)
         {
             selectedForm1.SetSelectedIndividual(items.item1);
             individual1 = items.item1;
         }
         if (selectedForm2 != null)
         {
             selectedForm2.SetSelectedIndividual(items.item2);
             individual2 = items.item2;
         }
     }
 }
コード例 #3
0
        void ExportListConents(bool html)
        {
            SaveFileDialog fileDlg = new SaveFileDialog();

            if (html)
            {
                fileDlg.Filter = "Compare List|*.html";
            }
            else
            {
                fileDlg.Filter = "Compare List|*.txt";
            }
            fileDlg.InitialDirectory = utility.GetCurrentDirectory();

            if (fileDlg.ShowDialog(this) == System.Windows.Forms.DialogResult.OK)
            {
                //FileStream saveList = new FileStream(fileDlg.FileName, FileMode.Create);
                StreamWriter exportFile = new StreamWriter(fileDlg.FileName);

                bool found1 = false;
                bool found2 = false;
                FamilyTreeStoreBaseClass familyTree1 = null;
                FamilyTreeStoreBaseClass familyTree2 = null;

                SavedMatches matches = new SavedMatches();
                matches.database1 = selectedForm1.Text;
                matches.database2 = selectedForm2.Text;
                int i = 0;
                foreach (FamilyForm2 form in formList)
                {
                    if (matches.database1 == form.Text)
                    {
                        found1                 = true;
                        selectedForm1          = form;
                        familyTree1            = form.GetTree();
                        listBox1.SelectedIndex = i;
                    }
                    if (matches.database2 == form.Text)
                    {
                        found2                 = true;
                        selectedForm2          = form;
                        familyTree2            = form.GetTree();
                        listBox2.SelectedIndex = i;
                    }
                    i++;
                }

                if (found1 && found2)
                {
                    if (html)
                    {
                        exportFile.WriteLine("<!DOCTYPE html><html><head><title>List of possible duplicate people</title></head><body><table><tr><th>Name1 (Birth - Death)</th><th>Name2 (Birth - Death)</th></tr>\n");
                    }
                    else
                    {
                        exportFile.WriteLine("Url\tName\tBirth\tDeath\tUrl\tName\tBirth\tDeath");
                    }

                    foreach (ListViewItem item in matchListView1.Items)
                    {
                        DuplicateTreeItems matchingPersons = (DuplicateTreeItems)item.Tag;
                        IndividualClass    person1 = null, person2 = null;

                        person1 = familyTree1.GetIndividual(matchingPersons.item1);
                        person2 = familyTree2.GetIndividual(matchingPersons.item2);
                        if ((person1 != null) && (person2 != null))
                        {
                            if (html)
                            {
                                exportFile.WriteLine("\n<tr>\n");
                            }
                            FormatPerson(person1, html, exportFile);
                            FormatPerson(person2, html, exportFile);
                            if (html)
                            {
                                exportFile.WriteLine("\n</tr>\n");
                            }
                        }
                    }
                }

                if (html)
                {
                    exportFile.WriteLine("\n</table></body></html>");
                }
                exportFile.Close();
            }
        }