Exemplo n.º 1
0
        private void _navigationView_NavigationItemSelected(object sender, NavigationView.NavigationItemSelectedEventArgs e)
        {
            switch (e.MenuItem.ItemId)
            {
            case Resource.Id.nav_exit:
            {
                var    dialog  = new Android.App.AlertDialog.Builder(this);
                string message = "Вы действительно хотите выйти?";
                dialog.SetMessage(message);

                dialog.SetPositiveButton("Да", delegate { LogOut(); });
                dialog.SetNegativeButton("Нет", delegate { });
                dialog.Show();
                break;
            }

            case Resource.Id.nav_profile:
            {
                var trans = SupportFragmentManager.BeginTransaction();
                var categoriesContainerFragment = ProfileFragment.newInstance();
                trans.Replace(Resource.Id.mainFragmentContainer, categoriesContainerFragment);
                trans.Commit();
                break;
                break;
            }

            case Resource.Id.nav_feed:
            {
                ShowFeed();
                break;
            }

            case Resource.Id.nav_groups:
            {
                var trans = SupportFragmentManager.BeginTransaction();
                var categoriesContainerFragment = GroupsFragment.newInstance(false);
                trans.Replace(Resource.Id.mainFragmentContainer, categoriesContainerFragment);
                trans.Commit();
                break;
            }
            }
            e.MenuItem.SetChecked(true);
            _drawerLayout.CloseDrawers();
        }
        public void FillTabs()
        {
            var host = _prefs.GetString("host", null);

            _manager = new ApiManager(host);
            var token = _prefs.GetString("token", null);

            fragments = new List <Android.Support.V4.App.Fragment>
            {
                InvitesFragment.newInstance(),
                    GroupsFragment.newInstance(true),
                CreateGroupFragment.newInstance()
            };
            titles = new List <string>
            {
                "Приглашения",
                "Найти",
                "Добавить"
            };
        }