Exemplo n.º 1
0
        public override bool FinishedLaunching(UIApplication app, NSDictionary options)
        {
            _rootViewController = new UIViewController();

            //
            // Create the root view
            //
            _worldView = new WorldView(window.Bounds)
            {
                ShowSun = false,
            };
            _rootViewController.View.AddSubview(_worldView);
            window.RootViewController = _rootViewController;
            _worldView.Run(4);

            //
            // Add a layer of tiles
            //
            var tiles       = new TileRenderer();
            var sourceIndex = 0;

            tiles.Source = _tileSources[sourceIndex];
            _worldView.AddDrawable(tiles);

            //
            // Add a button to toggle tile sources
            //
            var toggle = new UIButton(new RectangleF(0, 450, 120, 30));

            toggle.Font = UIFont.BoldSystemFontOfSize(14);
            toggle.SetTitle(_tileSources[0].Name, UIControlState.Normal);
            toggle.SetTitleColor(UIColor.Black, UIControlState.Normal);
            toggle.TouchUpInside += delegate {
                sourceIndex = (sourceIndex + 1) % _tileSources.Length;
                toggle.SetTitle(_tileSources[sourceIndex].Name, UIControlState.Normal);
                tiles.Source = _tileSources[sourceIndex];
            };
            window.AddSubview(toggle);

            window.MakeKeyAndVisible();

            return(true);
        }