示例#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
        public void ClearMemory()
        {
            BookTitle = null;
            BookID    = 0;
            if (TOCNodeList != null)
            {
                TOCNodeList.Clear();
            }
            if (RootNodeList != null)
            {
                RootNodeList.Clear();
            }

            CurrentLevel     = 1;
            CurrentLeafNode  = null;
            CurrentHighlight = 1;
            CurrentTocID     = -1;
            StartTocID       = 0;
            EndTocID         = 0;
            if (SearchTermWordList != null)
            {
                SearchTermWordList.Clear();
            }
            if (SearchKeyWordList != null)
            {
                SearchKeyWordList.Clear();
            }
            CurrentSearchContent = null;
            CurrentSearchHeader  = null;
        }
示例#3
0
        void UpdateTOCNodeList()
        {
            if (TOCNodeList == null)
            {
                return;
            }

            if (TOCNodeList.Count > 0)
            {
                var parentNode = TOCNodeList [0].ParentNode;

                while (parentNode != null)
                {
                    if (parentNode.NodeLevel == 0)
                    {
                        break;
                    }
                    TOCNodeList.Insert(0, parentNode);
                    parentNode = TOCNodeList [0].ParentNode;
                }
            }

            var rootNode = new TOCNode();

            rootNode.Title     = "Table of Contents";
            rootNode.NodeLevel = 0;
            TOCNodeList.Insert(0, rootNode);
        }
示例#4
0
        void UpdateTOCNodeListAndRefreshTableView()
        {
            if (TOCNodeList == null)
            {
                return;
            }

            if (TOCNodeList != null && TOCNodeList.Count > 0)
            {
                var parentNode = TOCNodeList [0].ParentNode;

                while (parentNode != null)
                {
                    if (parentNode.NodeLevel == 0)
                    {
                        parentNode.Title = "Table of Contents";
                    }
                    //TOCNodeList.Insert (0, parentNode);
                    l.Add(parentNode);
                    parentNode = l [0].ParentNode;
                }
                l.AddRange(TOCNodeList);
                TOCNodeList.Clear();
                TOCNodeList.AddRange(l);
            }
            else
            {
            }

            PanelController.RefreshTOCViewData();
        }
示例#5
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();
            }
        }
示例#6
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);
            }
        }
示例#7
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();
        }
示例#8
0
        public void InitializeTOCDataByBookID(int bookID, int tocID)
        {
            BookID               = bookID;
            CurrentTocID         = tocID;
            CurrentHighlight     = 1;
            CurrentLeafNode      = null;
            CurrentSearchContent = null;

            if (RootNodeList != null)
            {
                RootNodeList.Clear();
            }
            if (TOCNodeList != null)
            {
                TOCNodeList.Clear();
            }
        }
示例#9
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);
        }
示例#10
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);
        }
        void UpdateTOCNodeListAndRefreshTableView()
        {
            if (TOCNodeList != null && TOCNodeList.Count > 0)
            {
                var parentNode = TOCNodeList [0].ParentNode;
                while (parentNode != null)
                {
                    TOCNodeList.Insert(0, parentNode);
                    parentNode = TOCNodeList [0].ParentNode;
                }

                var rootNode = new TOCNode();
                rootNode.Title     = "Table of Contents";
                rootNode.NodeLevel = 0;
                TOCNodeList.Insert(0, rootNode);
            }
            else
            {
            }

            PanelController.RefreshTOCViewData();
        }
        //collapse current node
        public void GetParentNodeTOCListByNodeID(int tocNodeID)
        {
            if (tocNodeID >= TOCNodeList.Count)
            {
                Console.WriteLine("GetParentNodeTOCListByNodeID node{0} error", tocNodeID);
                return;
            }

            TOCNode parentNode = TOCNodeList [tocNodeID].ParentNode;

            if (parentNode == null)
            {
                if (TOCNodeList.Count > 0)
                {
                    TOCNodeList.RemoveAll(item => item != null);
                }
                TOCNodeList.AddRange(RootNodeList);
            }
            else
            {
                List <TOCNode> nodeList = new List <TOCNode> (0);
                nodeList.AddRange(parentNode.ChildNodes);

                if (nodeList != null)
                {
                    if (TOCNodeList.Count > 0)
                    {
                        TOCNodeList.RemoveAll(item => item != null);
                    }
                    TOCNodeList = nodeList;
                }
            }

            CurrentLevel = TOCNodeList [0].NodeLevel;

            UpdateTOCNodeListAndRefreshTableView();
        }
        //expand current node
        public void GetSubNodeTOCListByNodeID(int tocNodeID)
        {
            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.RemoveAll(item => item != null);
                }

                TOCNodeList  = subNodeList;
                CurrentLevel = TOCNodeList [0].NodeLevel;

                UpdateTOCNodeListAndRefreshTableView();
            }
        }