/// <summary> /// Returns a fragment given a position /// </summary> /// <param name="position">The position</param> /// <returns>Returns the fragment</returns> public override Fragment GetItem(int position) { Bundle bundle = new Bundle(); bundle.PutBoolean(TicketFragmentBase.HasSnackBarBundleKey, true); Fragment fragment = null; switch (position) { case CustomerTicketsTab: fragment = new CustomerTicketsFragment(); bundle.PutBoolean(CustomerTicketsFragment.AutoLoadBundleKey, true); break; case MyTicketsTab: fragment = new DsrTicketsFragment(); break; } if (fragment == null) { throw new IllegalArgumentException(string.Format("I, {0} dont know what fragment to return for page {1}", this.GetType().FullName, position)); } fragment.Arguments = bundle; return(fragment); }
/// <summary> /// Returns a fragment given a position /// </summary> /// <param name="position">The position</param> /// <returns>Returns the fragment</returns> public override Fragment GetItem(int position) { string json = JsonConvert.SerializeObject(this.customerDetails); switch (position) { case CustomerTicketsFragmentPage: CustomerTicketsFragment customerTicketsFragment = new CustomerTicketsFragment(); customerTicketsFragment.SetArgument(CustomerTicketsFragment.CustomerBundleKey, this.customerDetails); return(customerTicketsFragment); case CustomerRegistrationInfoFragment: CustomerDetailFragment customerDetailFragment = new CustomerDetailFragment(); Bundle registrationInfoBundle = new Bundle(); registrationInfoBundle.PutString(CustomerDetailFragment.SearchResult, json); customerDetailFragment.Arguments = registrationInfoBundle; return(customerDetailFragment); case CustomerPhotosFragmentPage: FragmentCustomerPhotos customerPhotosFragment = new FragmentCustomerPhotos(); Bundle photosBundle = new Bundle(); photosBundle.PutString(FragmentCustomerPhotos.CustomerNationalIdBundleKey, this.customerDetails.NationalId); photosBundle.PutString(FragmentCustomerPhotos.CustomerPhoneBundleKey, this.customerDetails.Phone); customerPhotosFragment.Arguments = photosBundle; return(customerPhotosFragment); } throw new IllegalArgumentException(string.Format("I, {0} dont know what fragment to return for page {1}", this.GetType().FullName, position)); }