Ejemplo n.º 1
0
        private void btnAdd_Click(object sender, EventArgs e)
        {
            /*roster.AddPlayer();
             * roster.Focus();
             * roster.Select();*/
            TextInputDialog t  = new TextInputDialog("Enter player's name:", _MAX_CHAR_LENGTH);
            DialogResult    dr = t.ShowDialog();

            if (dr == DialogResult.OK)
            {
                if (!Contains(t.Text, true))
                {
                    if (t.Text.Contains(':'))
                    {
                        MessageBox.Show("The player's name cannot contain the character"
                                        + " \":\".",
                                        "",
                                        MessageBoxButtons.OK,
                                        MessageBoxIcon.Error);
                    }
                    else
                    {
                        AddPlayer(t.Text);
                    }
                }
                else
                {
                    MessageBox.Show("A player named '" + t.Text + "' is already listed"
                                    + " in the roster. Please use a unique name.",
                                    "",
                                    MessageBoxButtons.OK,
                                    MessageBoxIcon.Error);
                }
            }
        }
Ejemplo n.º 2
0
        private void mnuRename_Click(object sender, EventArgs e)
        {
            if (lstRoster.SelectedItems.Count == 1)
            {
                ListViewItem    l  = lstRoster.SelectedItems[0];
                TextInputDialog t  = new TextInputDialog("Change player's name:", l.Text, _MAX_CHAR_LENGTH);
                DialogResult    dr = t.ShowDialog();

                if (dr == DialogResult.OK)
                {
                    l.Text = t.Text;
                }
            }
        }