Beispiel #1
0
        public void FileLoadProgress(int progressPercent, string text = null)
        {
            trace.TraceInformation("FamilyForm2::FileLoadProgress(" + progressPercent + ")");

            if (progressPercent < 0)
            {
                familyTree = readFileWorker.GetFamilyTree();
                if (familyTree != null)
                {
                    if (trace.Switch.Level.HasFlag(SourceLevels.Information))
                    {
                        familyTree.Print();
                    }

                    toolStripProgressBar1.Visible = false;
                    toolStripStatusLabel1.Text    = familyTree.GetShortTreeInfo();//"I:" + familyTree.individualList.Count + " F:" + familyTree.familyList.Count + " N:" + familyTree.noteList.Count;

                    //PopulatePersonList();

                    ConnectPanelsToTree(familyTree);
                }
                else
                {
                    trace.TraceEvent(TraceEventType.Error, 0, "  Error: tree == null! " + DateTime.Now);
                }
                progressReporter = null;
                readFileWorker   = null;
            }
            else
            {
                TextCallback(progressPercent, text);
            }
        }
        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!");
            }
        }
Beispiel #3
0
        public void ImportFile(String FileName)
        {
            trace.TraceInformation("FamilyForm2::ImportFile(" + FileName + ")" + DateTime.Now);

            progressReporter = new AsyncWorkerProgress(FileLoadProgress);

            readFileWorker = new ReadFileWorker(this, progressReporter, FileName, ref familyTree, CompletedCallback);
        }
        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);
                }
            }
        }
Beispiel #5
0
        public void SaveFile(string filename, FamilyFileTypeOperation operation, int filterIndex)
        {
            trace.TraceInformation("FamilyForm2::SaveFile:" + filename + " idx:" + filterIndex);

            progressReporter = new AsyncWorkerProgress(FileSaveProgress);

            writeFileWorker = new WriteFileWorker(this, progressReporter, filename, operation, filterIndex, ref familyTree);

            if (operation == FamilyFileTypeOperation.Save)
            {
                this.Text = filename;
            }
        }
        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 startButton_MouseClick(object sender, MouseEventArgs e)
        {
            trace.TraceInformation("CompletenessViewPanel1::startButton_MouseClick()" + DateTime.Now);
            if ((selectedIndividual != null) && (startButton.Visible))
            {
                //SearchMode runMode = SearchMode.ParentMissing;

                stopButton.Enabled  = true;
                startButton.Enabled = false;

                descendantGenerationNoCtrl.Enabled = false;
                ancestorGenerationNoCtrl.Enabled   = false;

                //dateButton.Enabled = false;
                resultList.Items.Clear();


                int ancestorGenerations    = GetSelectedInt(ancestorGenerationNoCtrl);
                int descendantGenerationNo = GetSelectedInt(descendantGenerationNoCtrl);

                //limits = GetSanitySettings(utility.GetCurrentDirectory() + "\\SanitySettings.fssan");

                progressReporter = new AsyncWorkerProgress(CompletenessProgress);

                stats = new AncestorStatistics(familyTree, limits, ancestorGenerations, descendantGenerationNo, progressReporter, AncestorUpdate);
                trace.TraceInformation("selected:" + selectedIndividual.GetName() + " " + DateTime.Now);


                analyseTreeWorker = new CompletenessTreeWorker(this, progressReporter, selectedIndividual.GetXrefName(), ref stats);

                //AnalyseParents(selectedIndividual, ref stats, 1);

                //dateButton.Enabled = true;

                trace.TraceInformation(" Database: " + familyTree.GetSourceFileName() + " person " + selectedIndividual.GetName() + " " + DateTime.Now);
            }
            else
            {
                MessageBox.Show("Error: No person selected!");
            }
        }
        void StartSearch()
        {
            trace.TraceInformation("SearchPanel1::StartSearch()" + DateTime.Now);
            if (familyTree == null)
            {
                return;
            }
            //startButton.Enabled = false;
            //dateButton.Enabled = false;

            trace.TraceInformation("search:" + searchTextBox.Text + " " + DateTime.Now);

            if (searchTextBox.Text.Length > 0)
            {
                resultList.Items.Clear();
                if (searchTextBox.FindStringExact(searchTextBox.Text) == -1)
                {
                    searchTextBox.Items.Add(searchTextBox.Text);
                }
                startButton.Text    = "Searching...";
                startButton.Enabled = false;

                searchTextBox.Items.Add(searchTextBox.Text);

                progressReporter = new AsyncWorkerProgress(SearchProgress);

                //stats = new AncestorStatistics(familyTree, limits, ancestorGenerations, descendantGenerationNo, progressReporter, AncestorUpdate);
                //trace.TraceInformation("selected:" + searchTextBox.Text + " " + DateTime.Now);


                treeWorker = new TreeWorker(this, progressReporter, searchTextBox.Text, ref familyTree);


                startButton.Text    = "Searching...";
                startButton.Enabled = false;
            }
            trace.TraceInformation(" Database: " + familyTree.GetSourceFileName() + "  " + DateTime.Now);
        }
            public CompareTreeWorker(
                object sender,
                SavedMatches matches,
                AsyncWorkerProgress progress,
                FamilyTreeStoreBaseClass familyTree1,
                FamilyTreeStoreBaseClass familyTree2,
                ReportCompareResult resultReporter)
            {
                trace = new TraceSource("CompareTreeWorker", SourceLevels.All);

                resultReporterFunction = resultReporter;

                progressReporter = progress;
                this.matches     = matches;

                backgroundWorker = new BackgroundWorker();

                backgroundWorker.WorkerReportsProgress = true;
                if (matches == null)
                {
                    backgroundWorker.DoWork += new DoWorkEventHandler(DoWork);
                }
                else
                {
                    backgroundWorker.DoWork += new DoWorkEventHandler(DoWorkLoadFile);
                }

                backgroundWorker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(Completed);
                backgroundWorker.ProgressChanged    += new ProgressChangedEventHandler(ProgressChanged);

                WorkerInterface workerInterface = new WorkerInterface();

                workerInterface.familyTree1 = familyTree1;
                workerInterface.familyTree2 = familyTree2;
                backgroundWorker.RunWorkerAsync(workerInterface);
            }
 private void DoCompare(FamilyTreeStoreBaseClass familyTree1, FamilyTreeStoreBaseClass familyTree2, AsyncWorkerProgress reporter)
 {
     CompareTreeClass.CompareTrees(familyTree1, familyTree2, ReportMatchingProfiles, reporter);
 }