private void addSavedGame(SavedGameInfo gameData) { var itemView = new SavedGameItemView(); itemView.Data = gameData; gameList.Controls.Add(itemView); }
private void gameList_SelectedIndexChanged(object sender, EventArgs e) { this.loadButton.Enabled &= !(this.gameList.SelectedItem is Label); if (this.gameList.SelectedItem == null || !(this.gameList.SelectedItem is SavedGameItemView) || this.gameList.SelectedItem == this.selectedGame) { return; } if (this.selectedGame != null) { this.selectedGame.Deselect(); } this.selectedGame = this.gameList.SelectedItem as SavedGameItemView; this.selectedGame.OnSelect(); this.loadButton.Enabled = (this.selectedGame.Data != null); }