/// <summary> /// Event Listener for the Done Button the Add New Game page /// </summary> private void DoneButton_Click(object sender, RoutedEventArgs e) { string newTitle; int lastID; Int32.TryParse(currentGameList[currentGameList.Count - 1].ID, out lastID); //parse out the ID from the last game in the list int newID = lastID + 1; //Add one to the the last ID newTitle = "'" + newID + "'" + "," + "'" + NewGameTitle.Text + "'"; //make the new game info string SQLUltility.addToTable("games", "id, title", newTitle, cs); //add the new game to the table parentWindow.updateGameList(); //update the game list this.Close(); }
/// <summary> /// Event handle for the Done button on Add new File page /// </summary> private void DoneButton_Click(object sender, RoutedEventArgs e) { string newTitle; int newID; newID = currentFileList.Count + 1; //set the new ID to the the current count + 1 to keep track if (selectedFile != null) //if they have selected a file { //set up the new file info from the UI newTitle = "'" + newID + "'," + "'" + currentGameList[GameDropDown.SelectedIndex].ID + "'," + "'" + NewClipTitle.Text + "'," + "'" + NewClipDes.Text + "'," + "'" + selectedFile + "'"; //Call the add to table funciton to add the new file to the table SQLUltility.addToTable("files", "id, game_id, title, description, filename", newTitle, cs); parentWindow.updateGameList(); //update the gamelist NoClip.Visibility = Visibility.Hidden; //make sure the "No Clip" error is hidden this.Close(); } else { NoClip.Visibility = Visibility.Visible;//if no clip selected throw up the error } }