public Button CreateMenuButton() { // Create the button that opens the window MenuButton = new Button(ControlManager.Manager) { Text = "Menu" }; MenuButton.Init(); MenuButton.Click += (sender, args) => OpenMenu(); ControlManager.Add(MenuButton); // Create the window MenuWindow = new Window(ControlManager.Manager) { Text = "Menu window" }; MenuWindow.Init(); MenuWindow.Hide(); const int padding = 16, buttonWidth = 300, buttonHeight = 30; var yPos = padding; var xPos = MenuWindow.Controls.First().Width / 2 - buttonWidth / 2; var descriptionLabel = new Label(ControlManager.Manager) { Left = padding / 2, Top = yPos, Width = 400, Text = "Click what option you want, or press close to continue.", }; descriptionLabel.Init(); MenuWindow.Add(descriptionLabel); yPos += descriptionLabel.Height + padding * 2; var menuInfos = new[] { new Tuple<string, EventHandler>("View Game Status", (sender, args) => { CloseMenuWindow(); CreateGameResult(); }), new Tuple<string, EventHandler>("Sell House", (sender, args) => { CloseMenuWindow(); CreateSellHouseWindow(); }), new Tuple<string, EventHandler>("Repay Loan", (sender, args) => { CloseMenuWindow(); CreateRepayLoanWindow(); }), new Tuple<string, EventHandler>("Return to previous screen", (sender, args) => _returnToMainMenu()), new Tuple<string, EventHandler>("Exit Game", (sender, args) => ControlManager.Manager.MainWindow.Close()) }; foreach (var menuInfo in menuInfos) { var menuButton = new Button(ControlManager.Manager) { Text = menuInfo.Item1, Top = yPos, Left = xPos, Width = buttonWidth, Height = buttonHeight }; menuButton.Init(); menuButton.Click += menuInfo.Item2; MenuWindow.Add(menuButton); yPos += menuButton.Height + padding; } MenuWindow.Closing += (sender, args) => { MenuButton.Enabled = true; CloseMenuWindow(); }; ControlManager.Add(MenuWindow); return MenuButton; }