Example #1
0
        private void buttonEdit_Click(object sender, EventArgs e)
        {
            if (listViewPlayers.SelectedIndices.Count > 0)
            {
                int           nPlayer = listViewPlayers.SelectedIndices[0];
                AddPlayerForm form    = new AddPlayerForm(PlayerMode.PM_EDIT,
                                                          GameStats.gameResults[nPlayer].player);
                form.ShowDialog();

                string s = string.Format("{0} ({1} $)", form.GetPlayer().Name, form.GetPlayer().Money);
                listViewPlayers.Items[nPlayer].Text = s;

                ChangedPlayer = true;
            }
        }
Example #2
0
        private void buttonAdd_Click(object sender, EventArgs e)
        {
            // check if all MAX_PLAYERS players are in the game already
            if (GetActivePlayers().Count() == BlackjackGame.MAX_PLAYERS)
            {
                MessageBox.Show(string.Format(
                                    "You can't add a new player to the game!\nAll {0} players are in the game!",
                                    BlackjackGame.MAX_PLAYERS));
                return;
            }

            // try adding new player
            AddPlayerForm form = new AddPlayerForm();

            if (form.ShowDialog() == DialogResult.OK)
            {
                BlackjackResult res = new BlackjackResult();
                res.player   = form.GetPlayer();
                res.results  = new List <PlayerResult>();
                res.shuffles = new List <int>();
                res.stakes   = new List <int>();

                GameStats.gameResults.Add(res);

                // find the current shuffle (current column in the stats table)
                int nColumns = TotalColumns();

                ListViewItem item = new ListViewItem(string.Format("{0} ({1} $)", form.GetPlayer().Name, form.GetPlayer().Money));
                listViewPlayers.Items.Add(item);

                for (int i = 0; i < nColumns; i++)
                {
                    item.SubItems.Add("");
                }

                ShowStatistics();

                ChangedPlayer = true;
            }
        }
Example #3
0
        private void buttonAdd_Click(object sender, EventArgs e)
        {
            // check if all MAX_PLAYERS players are in the game already
            if (GetActivePlayers().Count() == BlackjackGame.MAX_PLAYERS)
            {
                MessageBox.Show( string.Format(
                                    "You can't add a new player to the game!\nAll {0} players are in the game!",
                                    BlackjackGame.MAX_PLAYERS ) );
                return;
            }

            // try adding new player
            AddPlayerForm form = new AddPlayerForm();
            if (form.ShowDialog() == DialogResult.OK)
            {
                BlackjackResult res = new BlackjackResult();
                res.player = form.GetPlayer();
                res.results = new List<PlayerResult>();
                res.shuffles = new List<int>();
                res.stakes = new List<int>();

                GameStats.gameResults.Add( res );

                // find the current shuffle (current column in the stats table)
                int nColumns = TotalColumns();

                ListViewItem item = new ListViewItem(string.Format("{0} ({1} $)", form.GetPlayer().Name, form.GetPlayer().Money) );
                listViewPlayers.Items.Add(item);

                for (int i = 0; i < nColumns; i++)
                {
                    item.SubItems.Add("");
                }

                ShowStatistics();

                ChangedPlayer = true;
            }
        }
Example #4
0
        private void buttonEdit_Click(object sender, EventArgs e)
        {
            if (listViewPlayers.SelectedIndices.Count > 0)
            {
                int nPlayer = listViewPlayers.SelectedIndices[0];
                AddPlayerForm form = new AddPlayerForm( PlayerMode.PM_EDIT,
                                                            GameStats.gameResults[nPlayer].player );
                form.ShowDialog();

                string s = string.Format("{0} ({1} $)", form.GetPlayer().Name, form.GetPlayer().Money );
                listViewPlayers.Items[nPlayer].Text = s;

                ChangedPlayer = true;
            }
        }