Exemplo n.º 1
0
        public void RefreshContent(bool _force = false)
        {
            TaxonTreeNode node      = _MainTaxon;
            bool          recursive = Recursive;

            if (_AlternativeTaxon != null)
            {
                bool hasComment = TaxonComments.CommentFile(_AlternativeTaxon) != null;
                if (!hasComment && AddFranceMap)
                {
                    hasComment = (TaxonUtils.Locations != null) && TaxonUtils.Locations.LocationByTaxon.ContainsKey(_AlternativeTaxon.GetOriginal());
                }
                if (hasComment)
                {
                    node      = _AlternativeTaxon;
                    recursive = false;
                }
            }

            if (!_force && _Current == node)
            {
                OnDocumentCompleted?.Invoke(this, EventArgs.Empty);
                return;
            }

            _Current = node;
            ClearComments();
            if (node != null)
            {
                TaxonComments.Manager.GetComment(this, node, recursive, OnCommentLoaded);
                // BuildHtml();
                // webBrowser.DocumentText = HtmlDocument;
            }
        }
        void ExportComments(TaxonTreeNode _node, ExportData _data)
        {
            _data.ProgressItem.Update(_data.ProgressItem.Current + 1);
            List <CommentFileDesc> comments = TaxonComments.GetAllCommentFile(_node);

            if (comments == null)
            {
                return;
            }
            foreach (CommentFileDesc desc in comments)
            {
                if (desc.Collection == null)
                {
                    _data.Log.WriteLine("error: " + _node.Desc.RefMainName + " comment collection is null");
                    continue;
                }

                CopyCollectionInfo(desc.Collection.Path, _data);
                CopyFile(desc.GetHtmlName(), false, _data);
                CopyDirectory(desc.GetHtmlFilesDir(), _data);
            }
        }