public static bool Check(GameToSave game) { if (!ValidateTitle(game.Title)) { MessageBox.Show("Podaj nazwę gry!"); return(false); } if (!ValidateDesc(game.Description)) { MessageBox.Show("Podaj opis gry!"); return(false); } if (!ValidateDev(game.Developer)) { MessageBox.Show("Podaj twórcę gry!"); return(false); } return(true); }
private void btnAddGame_Click(object sender, RoutedEventArgs e) { var imageBytes = getJPGFromImageControl(imagePreview.Source as BitmapImage); if (imageBytes != null) { GameToSave addGame = new GameToSave(txtGameTitle.Text, new TextRange(rtbDescription.Document.ContentStart, rtbDescription.Document.ContentEnd).Text, txtDeveloper.Text, cbGenre.Text, txtLink.Text, imageBytes); if (GameValidator.Check(addGame)) { object[] args = { addGame.Title, addGame.Description, addGame.Genre, addGame.Image, addGame.Developer, addGame.Link }; addGame.Insert("Games", args); addGame.SelectGames(); Close(); } } }