public void LaadLijst(Game g) { /*lbGames.Items.Clear(); foreach (Game g in gamesApp.Games) { lbGames.Items.Add(g); }*/ lbGames.Items.Add(g); }
//Methods public bool VoegGameToe(Game game) { foreach (Game g in Games) { if (g.Titel == game.Titel) { return false; } } Games.Add(game); return true; }
public Form1() { InitializeComponent(); gamesApp = new GamesApp(this); Game g = new Game("The Elder Scrolls V: Skyrim", "RPG", "PC", 40, gamesApp); Game x = new Game("Assassins Creed: Black Flag", "Action-Adventure", "PC", 30, gamesApp); Game y = new Game("Fallout 4", "RPG", "PC", 45, gamesApp); gamesApp.VoegGameToe(g); gamesApp.VoegGameToe(x); gamesApp.VoegGameToe(y); }
private void btnAddGame_Click(object sender, EventArgs e) { if (txtTitle.Text != string.Empty && txtPlatform.Text != string.Empty && txtGenre.Text != string.Empty) { string title = txtTitle.Text; string platform = txtPlatform.Text; string genre = txtGenre.Text; decimal price = nudPrice.Value; Game game = new Game(title, genre, platform, price, gamesApp); gamesApp.VoegGameToe(game); } else { MessageBox.Show("Een of meerdere velden zijn inccorect ingevuld."); } }