예제 #1
0
        public void AddForFirstTeamPlayer(object sender, EventArgs e)
        {
            if (_mainManager.IfFieldsAreFilled(pOneFirstName.Text, pOneLastName.Text, firstNumber.Text, out int number))
            {
                activeMatch.Players.Add(_mainManager.CreatePlayer(pOneFirstName.Text, pOneLastName.Text, activeMatch.FirstTeam, number, activeMatch.Players.Count()));
                _mainManager.ResetPlayerFields(ref pOneFirstName, ref pOneLastName, ref firstNumber, ref ErrorLabel);

                var lastPlayer = activeMatch.Players.Last();
                _mainManager.AppendRichTextBox(ref richTextBox1, $"#{lastPlayer.Number} {lastPlayer.FirstName} {lastPlayer.LastName}\n");
            }
            else
            {
                _mainManager.SetError("Kļūda! Tukšs laukums.", ref ErrorLabel);
            }

            _mainManager.ShowButtonManage(ref ToStartGame, activeMatch.Players, timeInput, placeInput, tesniesi);
        }