public void RelationProgress(int progressPercent, string text = null) { trace.TraceInformation("RelationFinderViewPanel::RelationProgress(" + progressPercent + ")"); parentForm.TextCallback(progressPercent, text); if (progressPercent < 0) { //AddToListView(ref resultList, stats); if (relWorker != null) RelationStackList relations = relWorker.GetRelationStack(); if (relations != null) { this.relationList = relations; ShowRelations(this.relationList); SaveListToFile("relations_" + FamilyUtility.MakeFilename(familyTree.GetSourceFileName() + "_" + DateTime.Now.ToString() + "_" + resultNoCtrl.SelectedItem.ToString() + "_gen_" + ".fsrel"), relationList); } relWorker = null; //SaveListToFile(utility.GetCurrentDirectory() + "\\" + FamilyUtility.MakeFilename("relations_" + familyTree.GetSourceFileName() + "_" + DateTime.Now.ToString() + "_" + resultNoCtrl.SelectedItem.ToString() + "_gen_" + (checkDescendants ? "_desc_" : "") + ".fss")); resultNoCtrl.Enabled = true; stopButton.Enabled = false; startButton.Enabled = true; //descendants.Enabled = true; } }
void startButton_MouseClick(object sender, MouseEventArgs e) { trace.TraceInformation("RelationFinderPanel::startButton_MouseClick()" + DateTime.Now); if (familyTree.GetHomeIndividual() == null) { MessageBox.Show("Error: No root / base person selected!"); return; } if (selectedIndividual != null) { int noOfGenerations = AncestorStatistics.AllGenerations; RelationStackList relationList = new RelationStackList(); if (resultNoCtrl.SelectedItem.ToString() != "All") { noOfGenerations = Convert.ToInt32(resultNoCtrl.SelectedItem.ToString()); } AsyncWorkerProgress progress = new AsyncWorkerProgress(RelationProgress); //CheckRelation relation = new CheckRelation(familyTree, selectedIndividual.GetXrefName(), familyTree.GetHomeIndividual(), noOfGenerations, ref relationList); this.relWorker = new RelationTreeWorker(this, progress, selectedIndividual.GetXrefName(), familyTree.GetHomeIndividual(), noOfGenerations, familyTree); //ShowRelations(relationList.relations); //this.relationList = relationList; } else { MessageBox.Show("Error: No person selected!"); } }
public RelationFinderPanel() { controlList = new List <Control>(); this.Dock = DockStyle.Fill; parentForm = null; //checkDescendants = false; startButton = new Button(); startButton.Text = "Analyse"; startButton.Name = "Parent"; startButton.Left = 0; this.startButton.MouseClick += startButton_MouseClick; this.Controls.Add(startButton); stopButton = new Button(); stopButton.Left = startButton.Right; stopButton.Text = "Stop"; stopButton.Enabled = false; //stopButton. resultNoCtrl = new DomainUpDown(); resultNoCtrl.Left = stopButton.Right; resultNoCtrl.Items.Add("All"); for (int i = 20; i >= 5; i--) { resultNoCtrl.Items.Add(i.ToString()); } resultNoCtrl.SelectedItem = "5"; resultNoCtrl.Width = 50; //resultNoCtrl.AutoSize = true; this.Controls.Add(resultNoCtrl); this.stopButton.MouseClick += stopButton_MouseClick; this.Controls.Add(stopButton); resultList = new TreeView(); resultList.Top = startButton.Bottom; //resultList.Width = 400; //resultList.Height = 400; resultList.Anchor = AnchorStyles.Top | AnchorStyles.Left | AnchorStyles.Bottom | AnchorStyles.Right; resultList.Left = 3; //resultList.Margin.Right = 3; resultList.Location = new System.Drawing.Point(3, 20); resultList.Size = new System.Drawing.Size(200, 80); //resultList.Left = 3; resultList.NodeMouseClick += resultList_NodeMouseClick; resultList.ContextMenuStrip = new ContextMenuStrip(); ToolStripItem openItem = new ToolStripMenuItem(); openItem.Text = "Open..."; openItem.MouseUp += ContextMenuStrip_SelectOpen; ToolStripItem saveItem = new ToolStripMenuItem(); saveItem.Text = "Save..."; saveItem.MouseUp += ContextMenuStrip_SelectSave; ToolStripItem exportItemText = new ToolStripMenuItem(); exportItemText.Text = "Export text..."; exportItemText.MouseUp += ContextMenuStrip_SelectExportText; ToolStripItem exportItemHtml = new ToolStripMenuItem(); exportItemHtml.Text = "Export HTML..."; exportItemHtml.MouseUp += ContextMenuStrip_SelectExportHtml; //matchListView1.ContextMenuStrip.Items.Add("Open"); resultList.ContextMenuStrip.Items.Add(openItem); resultList.ContextMenuStrip.Items.Add(saveItem); resultList.ContextMenuStrip.Items.Add(exportItemText); resultList.ContextMenuStrip.Items.Add(exportItemHtml); utility = new FamilyUtility(); this.Controls.Add(resultList); relWorker = null; trace.TraceInformation("RelationFinderPanel::RelationFinderPanel()"); ResetGui(); }