private void OnResultItemClick(int pageNum, PageSearchItem searchItem) { var record = DataCache.INSTATNCE.Toc.GetNavigationItem() as ContentBrowserRecord; if (record == null || !NavigationManagerHelper.CompareActualTocId(record.TOCID, searchItem.TOCID) || record.PageNum != pageNum) { NavigationManager.Instance.AddRecord( new ContentBrowserRecord( NavigationManagerHelper.GetCurrentBookId(), searchItem.TOCID, pageNum, 0)); //WebViewManager.Instance.ClearWebViewStatus(WebViewManager.WebViewType.Content); } else { NavigationManagerHelper.MoveForthAndSetCurrentIndex(record.RecordID); WebViewManager.Instance.ClearWebViewStatus(WebViewManager.WebViewType.Content); DataCache.INSTATNCE.Toc.ResetNavigationItem(); } ((ContentActivity)Activity).GetMainFragment().SwitchLogicalMainTab(ContentMainFragment.TabContents); ((ContentActivity)Activity).GetMainFragment().Refresh(); Dismiss(); }
public void OnClick(View v) { if (DataCache.INSTATNCE.Toc == null) { return; } if (vh.Node == null) { // The node is "Table of Contents" if (DataCache.INSTATNCE.Toc.CurrentTOCNode != null) { vh.adaptor.SetCurrentNode( GetTopLevelNode(DataCache.INSTATNCE.Toc.CurrentTOCNode), false); } return; } if (vh.Node.IsParent()) { var isExpanded = DataCache.INSTATNCE.Toc.IsExpanded(vh.Node, vh.adaptor.NodeList); // switch the expanded status of current node vh.adaptor.SetCurrentNode(vh.Node, !isExpanded); } else { if (DataCache.INSTATNCE.Toc.IsCurrentNode(vh.Node)) { return; } var record = DataCache.INSTATNCE.Toc.GetNavigationItem(); if (record == null || !NavigationManagerHelper.CompareActualTocId(NavigationManagerHelper.ContentsTabGetTocId(record), vh.Node.ID)) { NavigationManager.Instance.AddRecord( new ContentBrowserRecord( DataCache.INSTATNCE.Toc.Publication.BookId, vh.Node.ID, 0)); } DataCache.INSTATNCE.Toc.CurrentTOCNode = vh.Node; DataCache.INSTATNCE.Toc.BindNavigationItem(); vh.adaptor.Activity.GetMainFragment().OpenContentPage(); vh.adaptor.NotifyDataSetChanged(); } }