Exemple #1
0
        private void button1_Click(object sender, EventArgs e)
        {
            if (textBox1.Text != "")
            {
                thisScore.name = textBox1.Text;
            }

            HighScores.Add(thisScore);
            HighScoreSort();

            if (HighScores.Count > 50)
            {
                List <HighScore> temp = new List <HighScore>();
                for (int i = 0; i < 50; i++)
                {
                    temp[i] = HighScores[i];
                }
                HighScores = temp;
            }

            var serializer = new XmlSerializer(HighScores.GetType(), "HighScores.Scores");

            using (var writer = new StreamWriter("highscores.xml", false))
            {
                serializer.Serialize(writer.BaseStream, HighScores);
            }

            var _HighScoreForm = new HighScoreForm(HighScores);

            _HighScoreForm.Show();
            this.Close();
        }
Exemple #2
0
 private void highScoreButton_Click(object sender, EventArgs e)
 {
     _HighScoreForm = new HighScoreForm(Highscores);
     _HighScoreForm.Show();
     pauseButton_Click(sender, e);
 }