Ejemplo n.º 1
0
        private void btnAddPlayer_Click(object sender, EventArgs e)
        {
            // If the length of the text is more then 0.. do this..
            if (txtEnterPlayerName.Text.Length > 0)
            {
                // Set the new PlayerName to the text in the textfield
                HangmanGame.PlayerName = txtEnterPlayerName.Text.ToString();
                // Give them a score of 0 to begin with
                HangmanGame.score = 0;
                var cc = new ConClass();
                // Insert the Players name and score into the database
                cc.InsertNewPlayer(HangmanGame.PlayerName, HangmanGame.score);

                // And update the list
                myList = cc.ViewAll();


                var da = new Resources.List_Adp(this, myList);
                // And display the updated list on the spinner
                PlayerNameSpinner.Adapter = da;
            }
            // Display a message if there is an empty textfield
            else
            {
                Toast.MakeText(this, "Please enter at least 1 character for your name", ToastLength.Short).Show();
            }
        }