private void RestartButton_Click_1(object sender, EventArgs e) { resetSeenJokes(); RestartButton.Hide(); JokeResult.Show(); Notification.Text = ""; JokeResult.Text = "Prepare for LULZ."; JokeButton.Show(); Like.Show(); Dislike.Show(); Settings.Default.CurrentJoke = 0; Settings.Default.Save(); }
public string getJoke() { string hereItIs = ""; int numJokes = Settings.Default.JokeList.Count; int indx = rand.Next(0, numJokes); bool allSeen = checkAllSeen(); if (allSeen) { JokeResult.Hide(); RestartButton.Show(); Notification.Text = "You've seen all the jokes!"; JokeResult.BackColor = Color.BlanchedAlmond; JokeButton.Hide(); Like.Hide(); Dislike.Hide(); } else { if (Settings.Default.JokeSeen[indx] == "0") { hereItIs = Settings.Default.JokeList[indx].ToString(); string jokeVal = Settings.Default.LikeOrDislike[indx].ToString(); if (jokeVal == "+") { JokeResult.BackColor = Color.OliveDrab; Notification.Text = "You liked this joke..."; } if (jokeVal == "-") { JokeResult.BackColor = Color.IndianRed; Notification.Text = "You disliked this joke..."; } } else { hereItIs = findNextUnseen(); } Settings.Default.CurrentJoke = indx; Settings.Default.JokeSeen[indx] = "1"; Settings.Default.Save(); } return(hereItIs); }
private void Reset_Click(object sender, EventArgs e) { RestartButton.Hide(); JokeResult.Show(); JokeResult.BackColor = Color.BlanchedAlmond; Notification.Text = ""; JokeResult.Text = "Prepare for LULZ."; JokeButton.Show(); Like.Show(); Dislike.Show(); Settings.Default.CurrentJoke = 0; for (int i = 0; i < Settings.Default.LikeOrDislike.Count; i++) { Settings.Default.LikeOrDislike[i] = "0"; Settings.Default.JokeSeen[i] = "0"; Settings.Default.Save(); } Settings.Default.Save(); }