public string getExcuse() { string hereItIs = ""; int numExcuses = Settings.Default.ExcuseList.Count; int indx = rand.Next(0, numExcuses); bool allSeen = checkAllSeenExcuses(); if (allSeen) { ExcuseText.Hide(); RestartExcuses.Show(); ExcuseNotification.Text = "You've seen all the excuses!"; ExcuseButton.Hide(); SendToEmail.Hide(); CopyButton.Hide(); BackButton.Hide(); ForwardButton.Hide(); } else { if (Settings.Default.ExcuseSeen[indx] == "0") { hereItIs = Settings.Default.ExcuseList[indx].ToString(); } else { hereItIs = findNextUnseenExcuse(); } Settings.Default.CurrentExcuse = indx; Settings.Default.ExcuseSeen[indx] = "1"; Settings.Default.Save(); } return(hereItIs); }
private void ResetExcuses_Click(object sender, EventArgs e) { RestartExcuses.Hide(); ExcuseText.Show(); ExcuseButton.Show(); BackButton.Hide(); ForwardButton.Hide(); CopyButton.Hide(); SendToEmail.Hide(); ExcuseNotification.Text = ""; ExcuseText.Text = "Excuses Ahead..."; BackBox.Items.Clear(); ForwardBox.Items.Clear(); BackBox.EndUpdate(); ForwardBox.EndUpdate(); Count = 0; Settings.Default.CurrentExcuse = 0; for (int i = 0; i < Settings.Default.ExcuseSeen.Count; i++) { Settings.Default.ExcuseSeen[i] = "0"; Settings.Default.Save(); } Settings.Default.Save(); }