private void importToolStripMenuItem_Click(object sender, EventArgs e) { if (this.ActiveMdiChild != null) { OpenFileDialog openFileDialog = new OpenFileDialog(); openFileDialog.InitialDirectory = utility.GetCurrentDirectory(); //openFileDialog.Filter = "Gedcom Files (*.ged)|*.ged|All Files (*.*)|*.*"; childForm = (FamilyForm2)this.ActiveMdiChild; openFileDialog.Filter = childForm.GetFileTypeFilter(FamilyFileTypeOperation.Import); if (openFileDialog.ShowDialog(this) == DialogResult.OK) { string FileName = openFileDialog.FileName; /*FamilyForm2*/ childForm.MdiParent = this; childForm.Show(); //trace.TraceInformation("strip: " + childForm.statusStrip1.Text + " " + childForm.statusStrip1.ToString() + " " + childForm.statusStrip1.Visible); childForm.ImportFile(FileName); if (childForm.Text.IndexOf(newFamilyTreeStringName) >= 0) { int filenameStart = FileName.LastIndexOf('\\'); if ((filenameStart >= 0) && (filenameStart < (FileName.Length - 1))) { FileName = FileName.Substring(FileName.LastIndexOf('\\') + 1); } childForm.Text += "; " + FileName; } } } }
public FlagsForm(FamilyForm2 parentForm) { InitializeComponent(); this.parentForm = parentForm; this.filterList = parentForm.filterList; RedrawFilterList(); listView1.Columns.Add("Title"); }
private void ShowNewForm(object sender, EventArgs e) { FamilyForm2 childForm = new FamilyForm2(true); childForm.MdiParent = this; childForm.Text = newFamilyTreeStringName + childFormNumber++; childForm.Show(); }
public MDIFamilyParent() { InitializeComponent(); individualForm = new IndividualForm(); FamilyForm2 childForm = new FamilyForm2(false); string webList = childForm.GetWebTypeList(); utility = new FamilyUtility(); if (webList.Length > 0) { toolStripMenuItemOpenWeb.Visible = true; int strPosStart = webList.IndexOf('{'); int strLength = webList.IndexOf('}') - 1; while ((strPosStart >= 0) && (strPosStart < webList.Length) && (strLength > 0)) { string webName = webList.Substring(strPosStart + 1, strLength); trace.TraceInformation("add sub menu:" + webName); ToolStripMenuItem newWebItem = new ToolStripMenuItem(); newWebItem.Name = webName; newWebItem.Text = webName; //newWebItem.MouseUp += newWebItem_MouseUp; newWebItem.Click += newWebItem_Click; toolStripMenuItemOpenWeb.DropDownItems.Add(newWebItem); if (webList.Substring(strPosStart + strLength).IndexOf('{') >= 0) { strPosStart = strPosStart + strLength + webList.Substring(strPosStart + strLength).IndexOf('{'); if ((strPosStart >= 0) && (strPosStart < webList.Length)) { strLength = webList.Substring(strPosStart).IndexOf('}') - 1; } } else { strPosStart = -1; } } } else { toolStripMenuItemOpenWeb.Visible = false; } }
void ReadListFromFile() { OpenFileDialog fileDlg = new OpenFileDialog(); fileDlg.InitialDirectory = utility.GetCurrentDirectory(); fileDlg.Filter = "Compare List|*.fsc"; if (fileDlg.ShowDialog(this) == System.Windows.Forms.DialogResult.OK) { DataContractSerializer serializer = new DataContractSerializer(typeof(SavedMatches)); FileStream readFile = new FileStream(fileDlg.FileName, FileMode.Open); SavedMatches matches; matches = (SavedMatches)serializer.ReadObject(readFile); readFile.Close(); bool found1 = false; bool found2 = false; familyTree1 = null; familyTree2 = null; 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) { matchListView1.Items.Clear(); AsyncWorkerProgress reporter = new AsyncWorkerProgress(WorkProgress); compareWorker = new CompareTreeWorker(this, matches, reporter, familyTree1, familyTree2, ReportCompareResultFunction); } } }
private void button1_Click(object sender, EventArgs e) { if (compareWorker != null) { trace.TraceInformation("Warning, compare already running..."); return; } if (listBox1.SelectedIndex < 0) { MessageBox.Show("No tree selected as first", "Error", MessageBoxButtons.OK); return; } if (listBox2.SelectedIndex < 0) { MessageBox.Show("No tree selected as second", "Error", MessageBoxButtons.OK); return; } string name1 = listBox1.Items[listBox1.SelectedIndex].ToString(); string name2 = listBox2.Items[listBox2.SelectedIndex].ToString(); FamilyTreeStoreBaseClass familyTree1 = null; FamilyTreeStoreBaseClass familyTree2 = null; foreach (FamilyForm2 form in formList) { if (form.Text.IndexOf(name1) >= 0) { familyTree1 = form.GetTree(); selectedForm1 = form; } if (form.Text.IndexOf(name2) >= 0) { familyTree2 = form.GetTree(); selectedForm2 = form; } } if ((familyTree1 != null) && (familyTree2 != null)) { matchListView1.Items.Clear(); AsyncWorkerProgress reporter = new AsyncWorkerProgress(WorkProgress); compareWorker = new CompareTreeWorker(this, null, reporter, familyTree1, familyTree2, ReportCompareResultFunction); button1.Text = "Stop"; } }
void newWebItem_Click(object sender, EventArgs e) { trace.TraceInformation("select sub menu:" + sender.ToString()); childForm = new FamilyForm2(); /*FamilyForm2*/ childForm.MdiParent = this; childForm.Text = "Family Tree:" + sender.ToString(); childForm.Show(); //trace.TraceInformation("strip: " + childForm.statusStrip1.Text + " " + childForm.statusStrip1.ToString() + " " + childForm.statusStrip1.Visible); childForm.OpenWeb(sender.ToString()); }
private void flagsToolStripMenuItem_Click(object sender, EventArgs e) { if (this.ActiveMdiChild != null) { FamilyForm2 activeForm = (FamilyForm2)this.ActiveMdiChild; FlagsForm flagsForm = new FlagsForm(activeForm); //flagsForm.filterList = this.ActiveMdiChild.filterList; flagsForm.Show(); //activeForm.filterList = flagsForm.GetFilterList(); // Force redraw of controls.. //activeForm.SetSelectedIndividual(activeForm.GetSelectedIndividual()); } }
private void toolStripMenuItemExport_Click(object sender, System.EventArgs e) { if (this.ActiveMdiChild != null) { SaveFileDialog saveFileDialog = new SaveFileDialog(); saveFileDialog.InitialDirectory = utility.GetCurrentDirectory(); //saveFileDialog.Filter = "GEDCOM Files (*.ged)|*.ged|All Files (*.*)|*.*"; childForm = (FamilyForm2)this.ActiveMdiChild; saveFileDialog.Filter = childForm.GetFileTypeFilter(FamilyFileTypeOperation.Export); if (saveFileDialog.ShowDialog(this) == DialogResult.OK) { string FileName = saveFileDialog.FileName; ((FamilyForm2)this.ActiveMdiChild).SaveFile(FileName, FamilyFileTypeOperation.Export, saveFileDialog.FilterIndex - 1); } } }
private void SaveAsToolStripMenuItem_Click(object sender, EventArgs e) { if (this.ActiveMdiChild != null) { SaveFileDialog saveFileDialog = new SaveFileDialog(); saveFileDialog.InitialDirectory = utility.GetCurrentDirectory(); //saveFileDialog.Filter = "GEDCOM Files (*.ged)|*.ged|All Files (*.*)|*.*"; childForm = (FamilyForm2)this.ActiveMdiChild; saveFileDialog.Filter = childForm.GetFileTypeFilter(FamilyFileTypeOperation.Save); if (saveFileDialog.ShowDialog(this) == DialogResult.OK) { string FileName = saveFileDialog.FileName; int index = saveFileDialog.FilterIndex - 1; // convert to zerobased ((FamilyForm2)this.ActiveMdiChild).SaveFile(FileName, FamilyFileTypeOperation.Save, index); } } }
private void OpenFile(object sender, EventArgs e) { OpenFileDialog openFileDialog = new OpenFileDialog(); openFileDialog.InitialDirectory = utility.GetCurrentDirectory(); //openFileDialog.Filter = "Gedcom Files (*.ged)|*.ged|All Files (*.*)|*.*"; childForm = new FamilyForm2(); openFileDialog.Filter = childForm.GetFileTypeFilter(FamilyFileTypeOperation.Open); if (openFileDialog.ShowDialog(this) == DialogResult.OK) { string FileName = openFileDialog.FileName; /*FamilyForm2*/ childForm.MdiParent = this; childForm.Show(); //trace.TraceInformation("strip: " + childForm.statusStrip1.Text + " " + childForm.statusStrip1.ToString() + " " + childForm.statusStrip1.Visible); childForm.OpenFile(FileName); } }
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(); } }