コード例 #1
0
        private void PopulateTreeParags(DocumentMap dMap, TreeNode nodeToAddTo)
        {
            var parags = dMap.GetParagraphs();

            foreach (var paragraph in parags)
            {
                var aNode = new MorphNode("");
                aNode.NodeType = clNodeType.clnParagraph;
                aNode.bdID     = paragraph.ParagraphID;
                nodeToAddTo.Nodes.Add(aNode);
            }
        }
コード例 #2
0
 private void PopulateTreeView()
 {
     treeView1.Nodes.Clear();
     foreach (var cont in store.containers)
     {
         var aNode = new MorphNode(cont.Name);
         aNode.NodeType = clNodeType.clnContainer;
         aNode.bdID     = cont.ContainerID;
         PopulateTreeChildrenConts(cont, aNode);
         PopulateTreeDocuments(cont, aNode);
         treeView1.Nodes.Add(aNode);
     }
 }
コード例 #3
0
        private void PopulateTreeDocuments(ContainerNode container, TreeNode nodeToAddTo)
        {
            var docs = container.GetDocuments();

            foreach (var doc in docs)
            {
                if (FindNode(doc.DocumentID, nodeToAddTo) != null)
                {
                    continue;
                }
                var aNode = new MorphNode(doc.Name);
                aNode.NodeType = clNodeType.clnDocument;
                aNode.bdID     = doc.DocumentID;
                PopulateTreeParags(doc, aNode);
                nodeToAddTo.Nodes.Add(aNode);
            }
        }
コード例 #4
0
        private void PopulateTreeChildrenConts(ContainerNode container, TreeNode nodeToAddTo)
        {
            var chldrn = container.Children();

            foreach (var chld in chldrn)
            {
                if (FindNode(chld.ContainerID, nodeToAddTo) != null)
                {
                    continue;
                }

                var aNode = new MorphNode(chld.Name);
                aNode.NodeType = clNodeType.clnContainer;
                aNode.bdID     = chld.ContainerID;
                nodeToAddTo.Nodes.Add(aNode);
            }
        }
コード例 #5
0
        public void SetContext(long contID, long docID, long parID, MorphNode theNode, treeOper tOper)
        {
            this.typeOper = tOper;
            this.contID   = contID;
            this.docID    = docID;
            this.parID    = parID;
            this.theNode  = theNode;
            ParagraphMap pMap = null;

            switch (tOper)
            {
            case (treeOper.toEdit):
                pMap = store.GetParagraph(contID, docID, parID);
                break;

            case (treeOper.toAdd):
                pMap = new ParagraphMap(-1, docID);
                break;
            }
            this.paraMap = new ParagraphMap(pMap);
        }
コード例 #6
0
        private void EditNode(MorphNode aNode)
        {
            if (aNode == null)
            {
                return;
            }

            switch (aNode.NodeType)
            {
            case clNodeType.clnParagraph:
            {
                var docNode   = aNode.Parent as MorphNode;
                var docID     = docNode.bdID;
                var contID    = (docNode.Parent as MorphNode).bdID;
                var parID     = aNode.bdID;
                var fParaEdit = new FormParaEdit(store);
                fParaEdit.SetContext(contID, docID, parID, aNode, treeOper.toEdit);
                fParaEdit.Show();
                break;
            }
            }
        }
コード例 #7
0
        private void btAddPara_Click(object sender, EventArgs e)
        {
            var aNode = treeView1.SelectedNode as MorphNode;

            if (aNode == null)
            {
                return;
            }

            MorphNode docNode = null;

            switch (aNode.NodeType)
            {
            case clNodeType.clnDocument:
                docNode = aNode;
                break;

            case clNodeType.clnParagraph:
                docNode = aNode.Parent as MorphNode;
                break;

            default:
                docNode = null;
                break;
            }
            if (docNode == null)
            {
                return;
            }

            var  docID     = docNode.bdID;
            var  contID    = (docNode.Parent as MorphNode).bdID;
            long parID     = -1;
            var  fParaEdit = new FormParaEdit(store);

            fParaEdit.SetContext(contID, docID, parID, docNode, treeOper.toAdd);
            fParaEdit.Show();
        }