public override void Initialize()
        {
            base.Initialize();
            //Add our services
            var controlHandler = new ControlHandler(this);
            _testControlManager = new TestControlManager(this);

            for (int x = 0; x < 4; x++)
                for (int y = 0; y < 4; y++)
                {
                    var testControl = new LinkLabel(_testControlManager, "TC-X" + x + "Y" + y, new Point(x, y))
                        {
                            Body = { Position = new Vector2(x * 135 + 40, y * 30 + 50) },
                        };
                    testControl.OnReleased += OnSelected;
                    //Set the default control.
                    if (x == 0 && y == 0)
                        testControl.OnFocusGain();
                }

            _actionLabel = new Label(_testControlManager, "TestContolLabel", new Point(5, 2));
            _actionLabel.Text = "TestControlLabel";
            _actionLabel.Body.Position = new Vector2(50, 400);
        }
        private void AddMenuItem(string label, ChangeStateDelegate changeStateDelegate)
        {
            var l = new LinkLabel(_page, "MenuItem" + (_lasttabposition.X ^ _lasttabposition.Y), _lasttabposition);

            l.Text = label;
            l.Body.Position = new Vector2(100, (_lasttabposition.Y * (l.Body.Height + 10) + 100));
            l.Render.Layer = .2f;
            l.OnReleased += control => changeStateDelegate();
            l.OnReleased += control => Destroy(this);

            _lasttabposition.Y++;

            if (l.TabPosition == Point.Zero) l.OnFocusGain();
        }
        public override void Initialize()
        {
            base.Initialize();

            new ControlHandler(this);

            _manager = new GameOfLifeManager(this, "Manager");
            _manager.UpdateTimer.LastEvent += CheckAllCells;

            //Cells = new Tilemap(this, "Cells", EntityGame.Game.Content.Load<Texture2D>(@"GameOfLife\tiles"), new Point(30,30),new Point(16,16));

            Cells = new Tilemap(this, "Cells", EntityGame.Self.Content.Load<Texture2D>(@"GameOfLife\tilesSmall"),
                                new Point(30, 30), new Point(1, 1));
            Cells.Render.Scale = new Vector2(16, 16);
            Cells.SetAllTiles(new Tile(DEAD) { Color = Color.Red.ToRGBColor() });
            //Position Tilemap to center
            Cells.Body.Position = new Vector2(EntityGame.Viewport.Width / 2f - Cells.Width / 2f * Cells.Render.Scale.X, 10);

            Cells.TileSelected += OnTileSelected;
            _tiles = Cells.CloneTiles();

            //GUI
            Page page = new Page(this, "Page");
            page.Show();

            LinkLabel startLink = new LinkLabel(page, "StartLink", new Point(0, 0));
            startLink.Body.Position = new Vector2(Cells.Body.X, 500);
            startLink.OnFocusGain();
            startLink.Text = "Start";
            startLink.OnReleased += control => _manager.Start();

            LinkLabel stopLink = new LinkLabel(page, "StopLink", new Point(0, 1));
            stopLink.Body.Position = new Vector2(Cells.Body.X, startLink.Body.Bottom);
            stopLink.Text = "Stop";
            stopLink.OnReleased += control => _manager.Stop();

            LinkLabel resetLink = new LinkLabel(page, "ResetLink", new Point(0, 2));
            resetLink.Body.Position = new Vector2(Cells.Body.X, stopLink.Body.Bottom);
            resetLink.Text = "ResetTimer";
            resetLink.OnReleased += control => ResetCells();

            LinkLabel downMillisecondsLink = new LinkLabel(page, "downMillisecondsLink", new Point(1, 0));
            downMillisecondsLink.Body.Position = new Vector2(Cells.Body.X + 100, startLink.Body.Bottom);
            downMillisecondsLink.Text = "<-";
            downMillisecondsLink.OnDown += control => _manager.UpdateTimer.Milliseconds -= 50;

            _millisecondsText = new Label(page, "millisecondsText", new Point(2, 0));
            _millisecondsText.Body.Position = new Vector2(downMillisecondsLink.Body.Right + 2, startLink.Body.Bottom);
            _millisecondsText.Text = _manager.UpdateTimer.Milliseconds.ToString();

            LinkLabel upMillisecondsLink = new LinkLabel(page, "upMillisecondsLink", new Point(3, 0));
            upMillisecondsLink.Body.Position = new Vector2(_millisecondsText.Body.Right + 25, startLink.Body.Bottom);
            upMillisecondsLink.Text = "->";
            upMillisecondsLink.OnDown += control => _manager.UpdateTimer.Milliseconds += 50;
        }