protected async override void OnCreate(Bundle savedInstanceState) { SetContentView(Resource.Layout.Tabs); base.OnCreate(savedInstanceState); // Create your application here tabLayout = FindViewById <TabLayout>(Resource.Id.mainTabLayout); tabLayout.TabSelected += TabLayout_TabSelected; currentUser = JsonConvert.DeserializeObject <User>(Intent.GetStringExtra("user")); items = await ItemRepo.GetLocalItemsAsync(currentUser.City); fragmentNavigate(new BuyItemFragment(currentUser, items)); }
private async void TabLayout_TabSelected(object sender, TabLayout.TabSelectedEventArgs e) { switch (e.Tab.Position) { case 0: items = await ItemRepo.GetLocalItemsAsync(currentUser.City); fragmentNavigate(new BuyItemFragment(currentUser, items)); break; case 1: items = await ItemRepo.GetCurrentUsersItemsAsync(currentUser.Id); fragmentNavigate(new ViewItemsFragment(currentUser, items)); break; } }