コード例 #1
0
        private void NavigateForward()
        {
            BrowserRecord forwardBrowserRecord = AppDataUtil.Instance.Forward();

            if (forwardBrowserRecord != null)
            {
                List <Publication> cachedPublicationList = PublicationUtil.Instance.GetPublicationOffline();
                Publication        navigateToP           = cachedPublicationList.Find(o => o.BookId == forwardBrowserRecord.BookID);
                if (forwardBrowserRecord.RecordType == RecordType.ContentRecord)
                {
                    AppDataUtil.Instance.SetCurrentPublication(navigateToP);
                    ContentBrowserRecord contentBR = (ContentBrowserRecord)forwardBrowserRecord;
                    AppDataUtil.Instance.SetOpendTOC(AppDataUtil.Instance.GetTOCNodeByID(contentBR.TOCID));
                }
                else if (forwardBrowserRecord.RecordType == RecordType.SearchResultRecord)
                {
                    SearchBrowserRecord searchBR = (SearchBrowserRecord)forwardBrowserRecord;
                    AppDataUtil.Instance.SetCurrentPublication(navigateToP, searchBR.KeyWords);
                    AppDataUtil.Instance.SetOpendTOC(AppDataUtil.Instance.GetTOCNodeByID(searchBR.TOCID));
                }
                else if (forwardBrowserRecord.RecordType == RecordType.AnnotationNavigator)
                {
                    //TODO, Back to annotation navigator
                }
            }
        }
コード例 #2
0
        private void AddNavigationPathAtBookIDandTocID(int bookID, int tocID, NavigationMode nm)
        {
            if (this.IsEnableAddNavigation)
            {
                this.IsEnableAddNavigation = false;
                return;
            }

            switch (nm)
            {
            case NavigationMode.NM_Contents:
                var contentRecord = new ContentBrowserRecord(bookID, tocID, 0);
                NavigationManager.Instance.AddRecord(contentRecord);
                break;

            case NavigationMode.NM_Search:
                var           wordList = TOCDataManager.SearchTermWordList;
                List <string> tempList = new List <string> ();
                tempList.AddRange(wordList);
//				SearchBrowserRecord(int bookID, int tocID, float webViewScrollPosition, int pageNum,
//					string keyWords, string headType, int headSequence, List<string> spliteKeywords = null, string refptId = null)
                var    headerList = TOCDataManager.CurrentSearchHeader.Split(',').ToList();
                string header     = null;
                int    index      = 0;
                if (headerList != null && headerList.Count == 2)
                {
                    header = headerList [0];
                    index  = Int32.Parse(headerList [1]);
                }
                var searchRecord = new SearchBrowserRecord(bookID, tocID, 0, 0, null, header, index, tempList);
                NavigationManager.Instance.AddRecord(searchRecord);
                break;

            case NavigationMode.NM_Annotations:
                break;
            }

            //Console.WriteLine ("addnavigation:{0}\n", nm);

            EnablePreNextButton();
        }