Ejemplo n.º 1
0
        private void btAddPalyer_Click(object sender, EventArgs e)
        {
            Player newPlayer = new Player();

            PlayerForm.DisplayPlayer(ref newPlayer);        // вызов формы отображения игрока

            currentTeam.AddPlayer(newPlayer);               // добавление нового игрока в список
            RefreshPlayers();                               // обновление списка игроков
        }
Ejemplo n.º 2
0
        private void lstPlayers_DoubleClick(object sender, EventArgs e)
        {
            if (lstPlayers.SelectedIndex != -1)
            {
                Player player = (Player)lstPlayers.SelectedItem;

                PlayerForm.DisplayPlayer(ref player);

                RefreshPlayers();
            }
        }
Ejemplo n.º 3
0
        public static void DisplayPlayer(ref Player player)
        {
            PlayerForm pf = new PlayerForm();

            // отображение данных игрока на форме
            pf.currentPlayer = player;
            pf.lbName.Text   = player.Name + " " + player.Surname;
            pf.lbAge.Text    = player.Age.ToString();
            pf.lbSkill.Text  = player.Skill.ToString();
            pf.lbHealth.Text = player.Health.ToString();
            // отображение позиции игрока в комбобоксе
            switch (player.Position)
            {
            case PLAYER_POSITION.BENCHWARMER:
            {
                pf.cbPosition.SelectedIndex = 0;
                break;
            }

            case PLAYER_POSITION.GOALKEEPER:
            {
                pf.cbPosition.SelectedIndex = 1;
                break;
            }

            case PLAYER_POSITION.HALFBACK:
            {
                pf.cbPosition.SelectedIndex = 2;
                break;
            }

            case PLAYER_POSITION.QUOTERBACK:
            {
                pf.cbPosition.SelectedIndex = 3;
                break;
            }

            case PLAYER_POSITION.FORWARD:
            {
                pf.cbPosition.SelectedIndex = 4;
                break;
            }

            default:
            {
                break;
            }
            }

            pf.ShowDialog();
        }