Exemplo n.º 1
0
        public bool OnNavigationItemSelected(IMenuItem item)
        {
            switch (item.ItemId)
            {
            case Resource.Id.navigation_publications:

                if (PublicationsFragment == null)
                {
                    this.PublicationsFragment = new PublicationsFragment();
                    this.FragmentCommit(PublicationsFragment, "Publications");
                }
                ShowFragment(PublicationsFragment);

                return(true);

            case Resource.Id.navigation_advert:

                if (AdvertFragment == null)
                {
                    AdvertFragment = new AdvertFragment();
                    this.FragmentCommit(AdvertFragment, "Advert");
                }
                ShowFragment(AdvertFragment);
                return(true);

            case Resource.Id.navigation_charity:

                if (CharityFragment == null)
                {
                    CharityFragment = new CharityFragment();
                    this.FragmentCommit(CharityFragment, "Charity");
                }
                ShowFragment(CharityFragment);
                return(true);

            case Resource.Id.navigation_organization:

                if (organizationFragment == null)
                {
                    organizationFragment = new OrganizationFragment();
                    this.FragmentCommit(organizationFragment, "Organization");
                }
                ShowFragment(organizationFragment);
                return(true);

            case Resource.Id.navigation_account:

                if (ProfileFragment == null)
                {
                    ProfileFragment = new ProfileFragment();
                    this.FragmentCommit(ProfileFragment, "Profile");
                }
                ShowFragment(ProfileFragment);
                return(true);
            }
            return(false);
        }
Exemplo n.º 2
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.activity_main);

            this.PublicationsFragment = new PublicationsFragment();
            this.CurrentFragment      = PublicationsFragment;
            this.FragmentCommit(PublicationsFragment, "Publications");



            _textMessage = FindViewById <TextView>(Resource.Id.message);
            BottomNavigationView navigation = FindViewById <BottomNavigationView>(Resource.Id.navigation);

            navigation.SetOnNavigationItemSelectedListener(this);
        }