コード例 #1
0
ファイル: HomeFragment.cs プロジェクト: davwheat/RevisR
        private void openComputing(object sender, System.EventArgs e)
        {
            Fragment fragment            = new Computing.ComputingHomeFragment();
            var      fragmentTransaction = FragmentManager.BeginTransaction();

            fragmentTransaction.Replace(Resource.Id.framecontainer, fragment);
            fragmentTransaction.AddToBackStack(null);
            fragmentTransaction.Commit();
        }
コード例 #2
0
ファイル: MainActivity.cs プロジェクト: davwheat/RevisR
        public bool OnNavigationItemSelected(IMenuItem item)
        {
            var      id       = item.ItemId;
            Fragment fragment = null;

            switch (id)
            {
            default:
                break;

            case Resource.Id.nav_home:
                fragment = new Fragments.HomeFragment();
                break;

            case Resource.Id.nav_english:
                fragment = new Fragments.English.EnglishHomeFragment();
                break;

            case Resource.Id.nav_maths:
                fragment = new Fragments.Maths.MathsHomeFragment();
                break;

            case Resource.Id.nav_geography:
                break;

            case Resource.Id.nav_history:
                break;

            case Resource.Id.nav_computing:
                fragment = new Fragments.Computing.ComputingHomeFragment();
                break;

            case Resource.Id.nav_share:
                break;

            case Resource.Id.nav_feedback:
                sendFeedback();
                return(false);

            case Resource.Id.nav_about:
                break;
            }

            if (fragment != null)
            {
                //home_fragment
                var fragmentTransaction = FragmentManager.BeginTransaction();
                fragmentTransaction.Replace(Resource.Id.framecontainer, fragment);
                fragmentTransaction.AddToBackStack(null);
                fragmentTransaction.Commit();

                var drawer = FindViewById <DrawerLayout>(Resource.Id.drawer_layout);
                drawer.CloseDrawer(GravityCompat.Start);
                return(true);
            }
            else
            {
                Common.notImplementedWarning(FindViewById(Android.Resource.Id.Content), ApplicationContext);
                return(false);
            }
        }