Beispiel #1
0
        private void OnStepTimer(object sender, EventArgs e)
        {
            game.Step();
            if (game.State == GameState.End)
            {
                stepTimer.Stop();
                SaveScoreWindow itemWindow = new SaveScoreWindow();
                itemWindow.TextBlockScore.Text = (Score - 1).ToString();
                itemWindow.ShowDialog();
                if (itemWindow.TextBoxName.Text == "")
                {
                    itemWindow.TextBoxName.Text = "Player";
                }
                Record itemRecord = new Record(itemWindow.TextBoxName.Text, Score - 1);
                myRecords.AddToRecords(itemRecord);

                if (DialogResult == true)
                {
                    itemWindow.Close();
                }
                if (itemWindow.flagSave)
                {
                    f = new FileStream(fileName, FileMode.Create, FileAccess.Write, FileShare.None);
                    SaveAsXML(myRecords, fileName, f);
                }
            }
        }