public override View OnCreateView(LayoutInflater inflater, ViewGroup container, Bundle savedInstanceState)
        {
            // Use this to return your custom view for this Fragment
            var theView = inflater.Inflate(Resource.Layout.PointOfPresenceLayout, container, false);

            galaxyBtn    = theView.FindViewById <TextView>(Resource.Id.GalaxyBtn);
            solSysBtn    = theView.FindViewById <TextView>(Resource.Id.SolSysBtn);
            planetBtn    = theView.FindViewById <TextView>(Resource.Id.PlanetBtn);
            sectorBtn    = theView.FindViewById <TextView>(Resource.Id.SectorBtn);
            structureBtn = theView.FindViewById <TextView>(Resource.Id.StructureBtn);

            galaxyBtn.Click    += GalaxyBtn_Click;
            solSysBtn.Click    += SolSysBtn_Click;
            planetBtn.Click    += PlanetBtn_Click;
            sectorBtn.Click    += SectorBtn_Click;
            structureBtn.Click += StructureBtn_Click;

            if (pop == null)
            {
                // no pop yet - better create one
                pop             = new PointOfPresenceObj();
                pop.created     = DateTime.Now;
                pop.playerId    = PhabrikServer.CurrentUser.Id;
                pop.nickname    = "primary";
                pop.scale       = PointOfPresenceObj.PopScale.System;
                pop.structureId = 0;
                SetScale(PointOfPresenceObj.PopScale.System);
            }
            curScale = PointOfPresenceObj.PopScale.None;
            RefreshForPop();

            return(theView);
        }
        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;
                }
            }
        }