示例#1
0
        public void GetTOCNodeListByCurrentLeafNode(TOCNode leafNode)
        {
            List <TOCNode> nodeList = new List <TOCNode> (0);

            nodeList.AddRange(leafNode.ParentNode.ChildNodes);

            if (nodeList != null)
            {
                if (TOCNodeList.Count > 0)
                {
                    TOCNodeList.Clear();
                }
                TOCNodeList.AddRange(nodeList);
                nodeList.Clear();
                nodeList = null;

                if (TOCNodeList.Any())
                {
                    CurrentLevel = TOCNodeList [0].NodeLevel;
                }

                UpdateTOCNodeList();
            }

            CurrentHighlight = -1;
        }
示例#2
0
        //expand current node
        public void GetSubNodeTOCListByNodeID(int tocNodeID)
        {
            if (TOCNodeList == null)
            {
                return;
            }

            if (tocNodeID >= TOCNodeList.Count)
            {
                //Console.WriteLine ("GetSubNodeTOCListByNodeID node{0} error", tocNodeID);
                return;
            }

            List <TOCNode> subNodeList = new List <TOCNode> (0);

            subNodeList.AddRange(TOCNodeList [tocNodeID].ChildNodes);
            if (subNodeList != null)
            {
                if (TOCNodeList.Count > 0)
                {
                    TOCNodeList.Clear();
                }

                TOCNodeList.AddRange(subNodeList);
                subNodeList.Clear();
                subNodeList = null;

                if (TOCNodeList.Any())
                {
                    CurrentLevel = TOCNodeList [0].NodeLevel;
                }

                UpdateTOCNodeList();
            }
        }
示例#3
0
        public async Task GetPublicationTocFromDB()
        {
            TOCNode rootNode = await PublicationContentUtil.Instance.GetTOCByBookId(BookID);

            if (rootNode == null)
            {
                return;
            }

            List <TOCNode> nodelist = rootNode.ChildNodes;

            if (nodelist == null)
            {
                return;
            }

            if (TOCNodeList.Count > 0)
            {
                TOCNodeList.Clear();
            }
            TOCNodeList.AddRange(nodelist);

            if (RootNodeList.Count > 0)
            {
                RootNodeList.Clear();
            }
            RootNodeList.AddRange(nodelist);

            if (TOCNodeList.Any())
            {
                CurrentLevel = TOCNodeList [0].NodeLevel;
            }

            if (CurrentTocID < 0)
            {
                UpdateTOCNodeList();
                PanelController.RefreshTOCViewData();
                CurrentLeafNode = rootNode.GetFirstPage();
                StartTocID      = CurrentLeafNode.ID;
                EndTocID        = CurrentLeafNode.ID;
            }
            else
            {
                TOCNode rootTocNode    = RootNodeList[0].ParentNode;
                TOCNode currentTocNode = PublicationContentUtil.Instance.GetTOCByTOCId(CurrentTocID, rootTocNode);
                GetTOCNodeListByCurrentLeafNode(currentTocNode);
                CurrentLeafNode = currentTocNode;
                StartTocID      = CurrentTocID;
                EndTocID        = CurrentTocID;
                PanelController.RefreshTOCViewData();
                PanelController.SelectTOCRectByTocID(currentTocNode.ID);
            }
        }
示例#4
0
        //collapse current node
        public void GetParentNodeTOCListByNodeID(int tocNodeID)
        {
            if (TOCNodeList == null)
            {
                return;
            }

            if (tocNodeID >= TOCNodeList.Count)
            {
                //Console.WriteLine ("GetParentNodeTOCListByNodeID node{0} error", tocNodeID);
                return;
            }

            TOCNode parentNode = TOCNodeList [tocNodeID].ParentNode;

            if (parentNode == null || parentNode.NodeLevel == 0)
            {
                if (TOCNodeList.Count > 0)
                {
                    TOCNodeList.Clear();
                }
                TOCNodeList.AddRange(RootNodeList);
            }
            else
            {
                List <TOCNode> nodeList = new List <TOCNode> (0);
                nodeList.AddRange(parentNode.ChildNodes);

                if (nodeList != null)
                {
                    if (TOCNodeList.Count > 0)
                    {
                        TOCNodeList.Clear();
                    }
                    TOCNodeList.AddRange(nodeList);
                    nodeList.Clear();
                    nodeList = null;
                }
            }

            if (TOCNodeList.Any())
            {
                CurrentLevel = TOCNodeList [0].NodeLevel;
            }

            UpdateTOCNodeList();
        }
示例#5
0
        public bool GetTOCNodeListByCurrentLeafNodeID(int nodeID, bool isScrollBottom)
        {
            while (CurrentLeafNode.ID != nodeID)
            {
                if (isScrollBottom)
                {
                    CurrentLeafNode = PublicationContentUtil.Instance.GetNextPageByTreeNode(CurrentLeafNode);
                }
                else
                {
                    CurrentLeafNode = PublicationContentUtil.Instance.GetPreviousPageByTreeNode(CurrentLeafNode);
                }
            }

            if (CurrentLeafNode == null)
            {
                return(false);
            }
            //Console.WriteLine ("CustomScrollDrag_CurrentLeafNode:{0}",CurrentLeafNode.Title);
            List <TOCNode> nodeList = new List <TOCNode> (0);

            nodeList.AddRange(CurrentLeafNode.ParentNode.ChildNodes);

            if (nodeList != null)
            {
                if (TOCNodeList.Count > 0)
                {
                    TOCNodeList.Clear();
                }
                TOCNodeList.AddRange(nodeList);
                nodeList.Clear();
                nodeList = null;

                if (TOCNodeList.Any())
                {
                    CurrentLevel = TOCNodeList [0].NodeLevel;
                }

                UpdateTOCNodeList();
            }

            CurrentHighlight = -1;
            return(true);
        }
示例#6
0
        public async void GetPublicationTocFromDB()
        {
            TOCNode rootNodeList = await PublicationContentUtil.Instance.GetTOCByBookId(BookID);

            CurrentLeafNode = rootNodeList.GetFirstPage();

            TOCNodeList = rootNodeList.ChildNodes;
            if (TOCNodeList != null)
            {
                RootNodeList.AddRange(TOCNodeList);
            }

            if (TOCNodeList.Any())
            {
                CurrentLevel = TOCNodeList [0].NodeLevel;
            }

            UpdateTOCNodeListAndRefreshTableView();
            PanelController.TOCController.OpenPublicationContentAtTOCNode(CurrentLeafNode);
        }