Ejemplo n.º 1
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.Select_P);

            ConClass myConnectionClass = new ConClass();

            myList = myConnectionClass.ViewAll();

            PlayerNameSpinner = FindViewById <Spinner>(Resource.Id.selectPlayerSpinner);
            Hangman_N.Resources.List_Adp da = new Resources.List_Adp(this, myList);

            PlayerNameSpinner.Adapter = da;

            PlayerNameSpinner.ItemSelected += new EventHandler <AdapterView.ItemSelectedEventArgs>(spinner_ItemSelected);

            txtEnterPlayerName = FindViewById <TextView>(Resource.Id.txtEnterName);

            Button btnStartGame = FindViewById <Button>(Resource.Id.btnStartGame);

            btnStartGame.Click += btnStartGame_Click;


            Button btnAddPlayer = FindViewById <Button>(Resource.Id.btnAddProfile);

            btnAddPlayer.Click += btnAddPlayer_Click;

            Button btnselectplayerMainMenu = FindViewById <Button>(Resource.Id.btnselectplayerMainMenu);

            btnselectplayerMainMenu.Click += btnselectplayerMainMenu_Click;
        }
Ejemplo n.º 2
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();
            }
        }
Ejemplo n.º 3
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.All_Score);

            myConnectionClass = new ConClass();
            myList            = myConnectionClass.ViewAll();
            Button btnHighScoresBack = FindViewById <Button>
                                           (Resource.Id.btnHighScoresBack);

            btnHighScoresBack.Click += btnHighScoresBack_Click;

            // Display the player names and high scores
            ListView HighScoresListView = FindViewById <ListView>(Resource.Id.HighScoresListView);

            HighScoresListView.Adapter = new List_Adp(this, myList);
        }