Ejemplo n.º 1
0
        private void btnBack_Click(object sender, EventArgs e)
        {
            // hide this form. unsure why this was necesary.
            this.Hide();

            // open frmRockPaperScissors
            frmRockPaperScissors frmRockPaperScissors = new frmRockPaperScissors();

            frmRockPaperScissors.ShowDialog();

            // close this form
            this.Close();
        }
Ejemplo n.º 2
0
        private void btnLoadfrmRockPaperScissors_Click(object sender, EventArgs e)
        {
            // save player names
            StreamWriter outputFile;

            outputFile = File.CreateText("PlayerNames.txt");
            outputFile.WriteLine(txtPlayerOneName.Text);
            outputFile.WriteLine(txtPlayerTwoName.Text);
            outputFile.Close();

            string player1 = lblPlayerOneName.Text;
            string player2 = lblPlayerTwoName.Text;

            StreamWriter sw2;

            sw2 = File.CreateText("PlayerOneWins.txt");
            sw2.WriteLine(player1 + " won:");
            sw2.Write("0");
            sw2.Close();

            StreamWriter sw3;

            sw3 = File.CreateText("PlayerTwoWins.txt");
            sw3.WriteLine(player2 + " won:");
            sw3.Write("0");
            sw3.Close();

            StreamWriter sw4;

            sw4 = File.CreateText("GamesPlayed.txt");
            sw4.WriteLine("Games Played:");
            sw4.Write("0");
            sw4.Close();


            this.Hide();

            // open frmRockPaperScissors
            frmRockPaperScissors frmRockPaperScissors = new frmRockPaperScissors();

            frmRockPaperScissors.ShowDialog();

            // close this form
            //this.Close();
        }