예제 #1
0
        public FamilyForm2(bool createTree = false)
        {
            trace              = new TraceSource("FamilyForm2", SourceLevels.Warning);
            nextTreeTabToAdd   = 0;
            nextPersonTabToAdd = 0;

            InitializeComponent();

            filterList = new List <IndividualFilterClass>();

            panelList = new List <TreeViewPanelBaseClass>();

            AddSearchPanel(new SearchPanel1());

            AddTreePanel(new AsyncTreePanel1());
            AddTreePanel(new TreeViewPanel2());
            AddTreePanel(new TreeViewPanel4());
            AddTreePanel(new TreeViewPanel5());
            AddTreePanel(new TreeViewPanel1());
            AddTreePanel(new ImageViewPanel1());

            AddPersonPanel(new PersonViewPanel1());
            AddPersonPanel(new SearchPanel1());
            AddPersonPanel(new CompletenessViewPanel1());
            AddPersonPanel(new RelationFinderPanel());
            //AddPersonPanel(new ComparePanel1());
            AddPersonPanel(new NotePanel());

            searchResultXrefList = new List <string>();

            foreach (TreeViewPanelBaseClass panel in panelList)
            {
                panel.SetParentForm(this);
            }
            m_addPersonForm = new AddPersonForm();

            m_addPersonForm.SetEventHandler(new System.EventHandler(AddPersonEvent));
            m_addPersonForm.Visible = false;

            if (createTree)
            {
                FamilyFileTypeCollection codec = new FamilyFileTypeCollection();
                //familyTree = new FamilyTreeStoreRam();
                //FamilyFileEncoderCollection codec = new FamilyFileEncoderCollection();

                familyTree = codec.CreateFamilyTreeStore("", CompletedCallback);

                //ConnectPanelsToTree(familyTree);
            }
            updateTimer          = new System.Windows.Forms.Timer();
            updateTimer.Tick    += new EventHandler(TimerEventProcessor);
            updateTimer.Interval = 1000 * 10; // 10 seconds
            updateTimer.Enabled  = true;
        }
예제 #2
0
        public ReadFileWorker(
            object sender,
            ProgressReporterInterface progress,
            string filename,
            ref FamilyTreeStoreBaseClass tree,
            CompletedCallback callback)
        {
            trace = new TraceSource("ReadFileWorker", SourceLevels.Warning);

            familyTree = tree;

            progressReporter = progress;

            backgroundWorker = new BackgroundWorker();

            backgroundWorker.WorkerReportsProgress = true;
            backgroundWorker.DoWork             += new DoWorkEventHandler(DoWork);
            backgroundWorker.RunWorkerCompleted += new RunWorkerCompletedEventHandler(Completed);
            backgroundWorker.ProgressChanged    += new ProgressChangedEventHandler(ProgressChanged);
            completedCallback = callback;

            codec = new FamilyFileTypeCollection();

            if (codec.IsKnownFileType(filename))
            {
                trace.TraceInformation("ReadFileWorker.DoWork(" + filename + "): OK!" + DateTime.Now);

                if (familyTree == null)
                {
                    familyTree = codec.CreateFamilyTreeStore(filename, completedCallback);
                }
                codec.SetProgressTarget(backgroundWorker);

                familyTree.SetSourceFileName(filename);
            }
            else
            {
                trace.TraceInformation("ReadFileWorker(" + workerFileName + "): Filetype unknown!" + DateTime.Now);
            }
            workerFileName = filename;
            backgroundWorker.RunWorkerAsync(filename);
        }