private void RateItButton_Click(object sender, EventArgs e) { int listPosition = WiiGameList.SelectedIndex; float addRating = 0; bool ratingFound = false; for (int i = 0; i < 5; i++) { if (rateSelected[i] == true) { ratingFound = true; addRating = i + 1; amountGameRated[listPosition] += 1; gameRating[listPosition] += addRating; } rateSelected[i] = false; rGreaterSelected[i] = false; } if (ratingFound == false) { string errorMessage = "No Rating Selected"; MessageBox.Show(errorMessage); } else { currentRate = gameRating[listPosition] / amountGameRated[listPosition]; string ratingText = WiiGameList.GetItemText(WiiGameList.SelectedItem) + "'s current Ranking: " + string.Format("{0:0.0}", currentRate); RatingLabel.Text = ratingText; StarRating1.FlatAppearance.BorderColor = Color.Gold; StarRating2.FlatAppearance.BorderColor = Color.Gold; StarRating3.FlatAppearance.BorderColor = Color.Gold; StarRating4.FlatAppearance.BorderColor = Color.Gold; StarRating5.FlatAppearance.BorderColor = Color.Gold; if (writeReviewReady == true) { StreamWriter sw = File.AppendText(Reviews[listPosition]); string rev = WriteReview.Text; if (String.IsNullOrWhiteSpace(rev)) { ReadGameDescriptionButton.PerformClick(); } else { sw.WriteLine(""); sw.WriteLine(""); sw.WriteLine("Game Rated: " + string.Format("{0:0.0}", addRating)); sw.WriteLine(rev); } sw.Close(); WriteReview.Clear(); ReadGameDescriptionButton.PerformClick(); } } }
// Show write review form private void button3_Click(object sender, EventArgs e) { WriteReview f = new WriteReview(uid, password, x.id); f.Show(); }