コード例 #1
0
        public override void OnDestroyView()
        {
            // drop the nested fragments to save RAM
            galaxyFragment    = null;
            solSysFragment    = null;
            planetFragment    = null;
            sectorFragment    = null;
            structureFragment = null;

            base.OnDestroyView();
        }
コード例 #2
0
        public void SetScale(PointOfPresenceObj.PopScale newScale)
        {
            if (newScale != curScale)
            {
                ClearScaleBtn();

                PopSubFragment newFragment = null;
                switch (newScale)
                {
                case PointOfPresenceObj.PopScale.Galaxy:
                    if (galaxyFragment == null)
                    {
                        galaxyFragment = new GalaxyPopFragment();
                    }
                    newFragment = galaxyFragment;
                    break;

                case PointOfPresenceObj.PopScale.System:
                    if (solSysFragment == null)
                    {
                        solSysFragment = new SolSysPopFragment();
                    }
                    newFragment = solSysFragment;
                    break;

                case PointOfPresenceObj.PopScale.Planet:
                    if (planetFragment == null)
                    {
                        planetFragment = new PlanetPopFragment();
                    }
                    newFragment = planetFragment;
                    break;

                case PointOfPresenceObj.PopScale.Sector:
                    if (sectorFragment == null)
                    {
                        sectorFragment = new SectorPopFragment();
                    }
                    newFragment = sectorFragment;
                    break;

                case PointOfPresenceObj.PopScale.Structure:
                    if (structureFragment == null)
                    {
                        structureFragment = new StructurePopFragment();
                    }
                    newFragment = structureFragment;
                    break;
                }
                if (newFragment != null)
                {
                    curScale = newScale;
                    SetScaleBtn();
                    newFragment.parent = this;
                    if (firstFrag)
                    {
                        FragmentManager.BeginTransaction().Add(Resource.Id.fragment, newFragment).Commit();
                    }
                    else
                    {
                        FragmentManager.BeginTransaction().Replace(Resource.Id.fragment, newFragment).Commit();
                    }
                    newFragment.Initialize();
                    firstFrag = false;
                }
            }
        }