Exemplo n.º 1
0
        public bool OnNavigationItemSelected(IMenuItem item)
        {
            int id = item.ItemId;

            if (id == Resource.Id.menuHome)
            {
                SupportActionBar.Title = "Home";
                ListItemClicked(0);
            }
            else if (id == Resource.Id.menuLocations)
            {
                SupportActionBar.Title = "Manage Locations";
                ListItemClicked(1);
            }
            else if (id == Resource.Id.menuStorages)
            {
                SupportActionBar.Title = "Manage Storages";
                ListItemClicked(2);
            }
            else if (id == Resource.Id.menuAddItem)
            {
                SupportActionBar.Title = "Add Item To Inventory";
                ListItemClicked(3);
            }
            else if (id == Resource.Id.menuShoplist)
            {
                SupportActionBar.Title = "Manage Shop List";
                ListItemClicked(4);
            }
            else if (id == Resource.Id.menuProducts)
            {
                SupportActionBar.Title = "Manage Products";
                ListItemClicked(6);
            }
            else if (id == Resource.Id.menuSummary)
            {
                SupportActionBar.Title = "Summary";
                ListItemClicked(7);
            }
            else if (id == Resource.Id.menuLogout)
            {
                Android.App.FragmentTransaction transaction    = FragmentManager.BeginTransaction();
                DialogFragmentLogout            dialogLocation = new DialogFragmentLogout();
                dialogLocation.Show(transaction, "dialogue fragment");
            }

            DrawerLayout drawer = FindViewById <DrawerLayout>(Resource.Id.drawer_layout);

            drawer.CloseDrawer(GravityCompat.Start);
            return(true);
        }
Exemplo n.º 2
0
 public override void OnBackPressed()
 {
     if (SupportActionBar.Title == "Home")
     {
         Android.App.FragmentTransaction transaction    = FragmentManager.BeginTransaction();
         DialogFragmentLogout            dialogLocation = new DialogFragmentLogout();
         dialogLocation.Show(transaction, "dialogue fragment");
     }
     else
     {
         SupportFragmentManager.BeginTransaction()
         .Replace(Resource.Id.content_frame, HomeFragment.NewInstance())
         .Commit();
     }
 }