public static bool CanBack(ContentMainFragmentState contentMainFragmentState)
        {
            switch (contentMainFragmentState.ShowingTab)
            {
            case ContentMainFragment.TabContents:
            {
                //if(NavigationManager.Instance.CurrentRecord.RecordType == RecordType.ContentRecord
                //   || NavigationManager.Instance.CurrentRecord.RecordType == RecordType.SearchResultRecord)
                //{
                //	return NavigationManager.Instance.CanBack;
                //}

                return(true);
            }

            case ContentMainFragment.TabIndex:
            {
                return(true);
            }

            case ContentMainFragment.TabAnnotations:
            {
                if (NavigationManager.Instance.CurrentRecord.RecordType == RecordType.AnnotationNavigator)
                {
                    return(NavigationManager.Instance.CanBack);
                }

                return(true);
            }

            default:
                throw new InvalidProgramException("Unknown content page main fragment showing tab id[" + contentMainFragmentState.ShowingTab + "]");
            }
        }
        public static BrowserRecord Back(ContentMainFragmentState contentMainFragmentState)
        {
            switch (contentMainFragmentState.ShowingTab)
            {
            case ContentMainFragment.TabContents:
            {
                if (NavigationManager.Instance.CurrentRecord.RecordType == RecordType.ContentRecord ||
                    NavigationManager.Instance.CurrentRecord.RecordType == RecordType.SearchResultRecord)
                {
                    return(NavigationManager.Instance.Back());
                }

                contentMainFragmentState.ShowingTab = ContentMainFragment.TabAnnotations;

                return(NavigationManager.Instance.CurrentRecord);
            }

            case ContentMainFragment.TabIndex:
            {
                if (NavigationManager.Instance.CurrentRecord.RecordType == RecordType.ContentRecord ||
                    NavigationManager.Instance.CurrentRecord.RecordType == RecordType.SearchResultRecord)
                {
                    contentMainFragmentState.ShowingTab = ContentMainFragment.TabContents;
                }
                else
                {
                    contentMainFragmentState.ShowingTab = ContentMainFragment.TabAnnotations;
                }

                return(NavigationManager.Instance.CurrentRecord);
            }

            case ContentMainFragment.TabAnnotations:
            {
                if (NavigationManager.Instance.CurrentRecord.RecordType == RecordType.AnnotationNavigator)
                {
                    return(NavigationManager.Instance.Back());
                }

                contentMainFragmentState.ShowingTab = ContentMainFragment.TabContents;

                return(NavigationManager.Instance.CurrentRecord);
            }

            default:
                throw new InvalidProgramException("Unknown content page main fragment showing tab id[" + contentMainFragmentState.ShowingTab + "]");
            }
        }
예제 #3
0
        public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            if (MainFragmentStatus == null)
            {
                var mainFragmentStatusCache = FileCacheHelper.ReadCacheFile(
                    ContentActivity.CacheCatagory,
                    string.Format(
                        MainFragmentStatusCacheFile,
                        ((ContentActivity)Activity).AsyncTaskActivityGUID));
                if (!string.IsNullOrEmpty(mainFragmentStatusCache))
                {
                    MainFragmentStatus = JsonConvert.DeserializeObject <ContentMainFragmentState>(mainFragmentStatusCache);
                }
            }

            if (MainFragmentStatus == null)
            {
                MainFragmentStatus = new ContentMainFragmentState();
            }

            var v = inflater.Inflate(Resource.Layout.content_main_fragment, container, false);

            if (((ContentActivity)Activity).Publication == null)
            {
                return(v);
            }

            //llLeftPanelContainer = v.FindViewById<LinearLayout>(Resource.Id.llLeftPanelContainer);
            //frLeftPanelContainer = v.FindViewById<FrameLayout>(Resource.Id.frLeftPanelContainer);
            llLeftPanelContainerStub = v.FindViewById <LinearLayout>(Resource.Id.llLeftPanelContainerStub);

            llMainBoard = v.FindViewById <LinearLayout>(Resource.Id.llMainBoard);

            //rgMainTab = v.FindViewById<RadioGroup>(Resource.Id.rgMainTab);
            //rbContents = v.FindViewById<RadioButton>(Resource.Id.rbContents);
            //rbIndex = v.FindViewById<RadioButton>(Resource.Id.rbIndex);
            rbAnnotations = v.FindViewById <RadioButton>(Resource.Id.rbAnnotations);

            //rgMainTab.CheckedChange += MainTabCheckedChange;

            LogHelper.Debug("dbg", "ContentMainFragment::OnCreateView");

            //var fragment = Activity.SupportFragmentManager.FindShowingFragmentById(Resource.Id.frLeftPanelContainer);
            //if (fragment == null)
            //{

            //    //var tocPanelFragment = new TOCPanelFragment();
            //    //transaction.Add(Resource.Id.frLeftPanelContainer, tocPanelFragment, TOCPanelFragment.FragmentTag);


            //}
            //var transaction = Activity.SupportFragmentManager.BeginTransaction();

            //transaction.Add(Resource.Id.frRightPanelContainer, contentFragment, ContentFragment.FragmentTag).Commit();
            //Activity.SupportFragmentManager.SaveFragmentInstanceState(new ContentFragment());

            var loginFragment = new ContentFragment();

            Activity.SupportFragmentManager.BeginTransaction().Add(Resource.Id.frRightPanelContainer, loginFragment).Commit();


            OpenContentPage();
            //Refresh();
            //SetLeftPanelStatus();

            return(v);
        }
 public static BrowserRecord Forth(ContentMainFragmentState contentMainFragmentState)
 {
     return(NavigationManager.Instance.Forth());
 }
 public static bool CanForth(ContentMainFragmentState contentMainFragmentState)
 {
     return(NavigationManager.Instance.CanForth);
 }