Esempio 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
                HomeScreen.PlayerName = txtEnterPlayerName.Text.ToString();
                // Give them a score of 0 to begin with
                HomeScreen.score = 0;
                var cc = new DBConnection();
                // Insert the Players name and score into the database
                String res = cc.InsertNewPlayer(HomeScreen.PlayerName, HomeScreen.score);
                // Toast.MakeText(this, txtEnterPlayerName.Text.ToString()+" "+ res, ToastLength.Short).Show();
                // And update the list
                myList = cc.ViewAll();
                //Toast.MakeText(this, txtEnterPlayerName.Text.ToString() + " " +myList.Count, ToastLength.Short).Show();


                var da = new Resources.DBDA(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();
            }
        }
Esempio n. 2
0
        private void btnDeleteEntry_Click(object sender, EventArgs e)
        {
            var cc = new DBConnection();

            cc.DeletePlayer(HomeScreen.Id);
            myList = cc.ViewAll();


            var da = new Resources.DBDA(this, myList);

            spinnerEditDB.Adapter = da;
        }
Esempio n. 3
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            SetContentView(Resource.Layout.PlayerSelection);

            DBConnection myConnectionClass = new DBConnection();

            myList = myConnectionClass.ViewAll();

            PlayerNameSpinner = FindViewById <Spinner>(Resource.Id.selectPlayerSpinner);
            DBDA da = new Resources.DBDA(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 += (object sender, EventArgs e) =>
            {
                btnStartGame_Click(sender, e);
            };


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

            btnAddPlayer.Click += (object sender, EventArgs e) =>
            {
                btnAddPlayer_Click(sender, e);
            };

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

            btnselectplayerMainMenu.Click += (object sender, EventArgs e) =>
            {
                btnselectplayerMainMenu_Click(sender, e);
            };
        }
Esempio n. 4
0
        //int Id;
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);

            SetContentView(Resource.Layout.MainDB);
            DBConnection myConnectionClass = new DBConnection();

            myList = myConnectionClass.ViewAll();

            btnEditDBMainMenu        = FindViewById <Button>(Resource.Id.btnEditDBMainMenu);
            btnEditDBMainMenu.Click += btnEditDBMainMenu_Click;
            spinnerEditDB            = FindViewById <Spinner>(Resource.Id.spinnereditDB);
            global::Hangman.Resources.DBDA da = new Resources.DBDA(this, myList);

            spinnerEditDB.Adapter = da;

            spinnerEditDB.ItemSelected += new EventHandler <AdapterView.ItemSelectedEventArgs>(spinnerEditDB_ItemSelected);

            btnDeleteEntry         = FindViewById <Button>(Resource.Id.btnDeleteEntry);
            btnDeleteEntry.Click  += btnDeleteEntry_Click;
            btnDeleteEntry.Enabled = false;
        }