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
                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();
            }
        }
Esempio n. 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;
        }
Esempio n. 3
0
        private void btn_Delete_Click(object sender, EventArgs e)
        {
            var cc = new Db_Connection();

            cc.DeletePlayer(HangmanGame.Id);
            List_All = cc.ViewAll();


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

            spinner_select.Adapter = da;
        }
Esempio n. 4
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);
            };
        }
Esempio n. 5
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.EditDB);
            ConnectionClass myConnectionClass = new ConnectionClass();

            myList = myConnectionClass.ViewAll();

            btnEditDBMainMenu        = FindViewById <Button>(Resource.Id.btnEditDBMainMenu);
            btnEditDBMainMenu.Click += btnEditDBMainMenu_Click;
            spinnerEditDB            = FindViewById <Spinner>(Resource.Id.spinnereditDB);
            Hangman.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;
        }
Esempio n. 6
0
        protected override void OnCreate(Bundle savedInstanceState)
        {
            base.OnCreate(savedInstanceState);
            SetContentView(Resource.Layout.Delete_Record);
            Db_Connection myConnectionClass = new Db_Connection();

            List_All = myConnectionClass.ViewAll();

            btn_Home_Page        = FindViewById <Button>(Resource.Id.btn_Home_Page);
            btn_Home_Page.Click += btn_Home_Page_Click;

            spinner_select = FindViewById <Spinner>(Resource.Id.spinner_select);
            Hangman.Resources.DataAdapter da = new Resources.DataAdapter(this, List_All);

            spinner_select.Adapter = da;

            spinner_select.ItemSelected += new EventHandler <AdapterView.ItemSelectedEventArgs>(spinner_select_ItemSelected);

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