コード例 #1
0
ファイル: frmPingPong.cs プロジェクト: jnsknn/ping-pong
        private void highScoresToolStripMenuItem_Click(object sender, EventArgs e)
        {
            try
            {
                if (gameover.gameover == true)
                {
                    DialogResult  dr            = new DialogResult();
                    frmHighScores frmhighscores = new frmHighScores();
                    dr = frmhighscores.ShowDialog();
                }
                else
                {
                    gameTimer.Stop();

                    DialogResult  dr            = new DialogResult();
                    frmHighScores frmhighscores = new frmHighScores();
                    dr = frmhighscores.ShowDialog();

                    if (dr == DialogResult.OK)
                    {
                        gameTimer.Start();
                    }
                }
            }
            catch (Exception exc)
            {
                MessageBox.Show("Error: " + exc + "\n" + "\n" + "Go to https://github.com/jnsknn/ping-pong/issues and see if there is an issue about this bug. If not, create a new issue or contact me via email.");
            }
        }
コード例 #2
0
        private void btnSave_Click(object sender, EventArgs e)
        {
            try
            {
                savename = string.Concat(txtNameTextBox.Text.Where(char.IsLetterOrDigit)); // This removes every char from string that is not letter or digit
                frmPingPong.saveHighScores(savename, frmPingPong.score);

                frmHighScores frmhighscores = new frmHighScores();
                frmhighscores.ShowDialog();
            }
            catch (Exception exc)
            {
                MessageBox.Show("Error: " + exc + "\n" + "\n" + "Go to https://github.com/jnsknn/ping-pong/issues and see if there is an issue about this bug. If not, create a new issue or contact me via email.");
            }
        }