private void GameSetTextBox_KeyUp(object sender, KeyEventArgs e) { if (e.Key == Key.Enter && sender is TextBox txtBox) { _gameBrain.SetGame(ToInt(txtBox.Text) - 1); txtBox.Text = ""; UpdateAllWindows(); } }