Ejemplo n.º 1
0
        private void SyncStatus(Publication pub)
        {
            if (!DataCache.INSTATNCE.Toc.IsCurrentNavigationItem())
            {
                var tocid = NavigationManagerHelper.ContentsTabGetTocId(NavigationManager.Instance.CurrentRecord);
                if (!NavigationManagerHelper.IsShowContentRecord(tocid))
                {
                    BrowserRecord record = DataCache.INSTATNCE.Toc.GetNavigationItem();
                    if (record == null)
                    {
                        record = NavigationManagerHelper.GetLastReasonableRecord(
                            new List <RecordType> {
                            RecordType.ContentRecord, RecordType.SearchResultRecord
                        });
                    }

                    if (record == null ||
                        (tocid = NavigationManagerHelper.ContentsTabGetTocId(record)) == NavigationManagerHelper.TocIdDefaultPage)
                    {
                        DataCache.INSTATNCE.Toc.CurrentTOCNode = DataCache.INSTATNCE.Toc.GetFirstPage();
                    }
                    else
                    {
                        DataCache.INSTATNCE.Toc.SetCurrentTOCNodeById(tocid);
                    }

                    tocListAdaptor.RefreshNodeList();
                    ((ContentActivity)Activity).GetMainFragment().OpenContentPage();
                    return;
                }

                if (tocid == NavigationManagerHelper.TocIdDefaultPage &&
                    NavigationManager.Instance.Records.Count > 1)
                {
                    DataCache.INSTATNCE.Toc.CurrentTOCNode = DataCache.INSTATNCE.Toc.GetFirstPage();
                }
                else
                {
                    DataCache.INSTATNCE.Toc.SetCurrentTOCNodeById(tocid);
                }

                DataCache.INSTATNCE.Toc.BindNavigationItem();
            }

            tocListAdaptor.RefreshNodeList();
            ((ContentActivity)Activity).GetMainFragment().OpenContentPage();
            return;
        }