コード例 #1
0
        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();
                }
            }
        }