示例#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
                Hangman.PlayerName = txtEnterPlayerName.Text.ToString();
                // Give them a score of 0 to begin with
                Hangman.score = 0;
                var cc = new DBConnection();
                // Insert the Players name and score into the database
                String res = cc.InsertNewPlayer(Hangman.PlayerName, Hangman.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.DataAdapter(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();
            }
        }
示例#2
0
        private void btnDeleteEntry_Click(object sender, EventArgs e)
        {
            var cc = new DBConnection();

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


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

            spinnerEditDB.Adapter = da;
        }
示例#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);
            DataAdapter da = new Resources.DataAdapter(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);
            };
        }
示例#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_xamarian.Resources.DataAdapter da = new Resources.DataAdapter(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;
        }