Пример #1
0
        public override Fragment GetItem(int position)
        {
            switch (position)
            {

            // Open ProfileTab
                case 0:
                    ProfilesFragment profileTabFragment = new ProfilesFragment();

                    return profileTabFragment;

            // Open BouquetsTab
                case 1:
                    BouquetsFragment bouquetsTabFragment = new BouquetsFragment();
                    return bouquetsTabFragment;

            // Open ServicesTab
                case 2:
                    ServicesFragment servicesTabFragment = new ServicesFragment();
                    return servicesTabFragment;

            // Open SignalTab
                case 3:
                    SignalFragment signalTabFragment = new SignalFragment();
                    return signalTabFragment;
            }
            return null;
        }
Пример #2
0
 private void ResetFragmentPositions()
 {
     var fragment = SupportFragmentManager.FindFragmentById(Resource.Id.container_body);
     if (fragment != null)
     {
         SupportFragmentManager.BeginTransaction().Remove(fragment).Commit();
     }
     if (fragment != null)
     {
         bool matched = false;
         var tProfiles = fragment as ProfilesFragment;
         if (tProfiles != null)
         {
             profilesFragment = tProfiles;
             matched = true;
         }
         if (!matched)
         {
             var tBouquets = fragment as BouquetsFragment;
             if (tBouquets != null)
             {
                 bouquetsFragment = tBouquets;
                 matched = true;
             }
         }
         if (!matched)
         {
             var tServices = fragment as ServicesFragment;
             if (tServices != null)
             {
                 servicesFragment = tServices;
                 matched = true;
             }
         }
         if (!matched)
         {
             var tSignal = fragment as SignalFragment;
             if (tSignal != null)
             {
                 signalFragment = tSignal;
             }
         }
     }
     if (profilesFragment == null)
     {
         profilesFragment = (ProfilesFragment)SupportFragmentManager.FindFragmentById(Resource.Id.profiles_layout);
         if (profilesFragment != null)
         {
             SupportFragmentManager.BeginTransaction().Remove(profilesFragment).Commit();
         }
     }
     if (bouquetsFragment == null)
     {
         bouquetsFragment = (BouquetsFragment)SupportFragmentManager.FindFragmentById(Resource.Id.bouquets_layout);
         if (bouquetsFragment != null)
         {
             SupportFragmentManager.BeginTransaction().Remove(bouquetsFragment).Commit();
         }
     }
     if (servicesFragment == null)
     {
         servicesFragment = (ServicesFragment)SupportFragmentManager.FindFragmentById(Resource.Id.services_layout);
         if (servicesFragment != null)
         {
             SupportFragmentManager.BeginTransaction().Remove(servicesFragment).Commit();
         }
     }
     if (signalFragment == null)
     {
         signalFragment = (SignalFragment)SupportFragmentManager.FindFragmentById(Resource.Id.signal_layout);
         if (signalFragment != null)
         {
             SupportFragmentManager.BeginTransaction().Remove(signalFragment).Commit();
         }
     }
     SupportFragmentManager.ExecutePendingTransactions();
     if (profilesFragment == null)
         profilesFragment = new ProfilesFragment();
     if (bouquetsFragment == null)
         bouquetsFragment = new BouquetsFragment();
     if (servicesFragment == null)
         servicesFragment = new ServicesFragment();
     if (signalFragment == null)
         signalFragment = new SignalFragment();
 }