Exemple #1
0
        public Offer()
        {
            Random rnd = new Random();
            playerteam = MainForm.l.getTeambyTeamName(MainForm.playerteam);

            foreach (Team t in MainForm.l.leagueTeams)
            {
                if (t.isplayers != true)
                {
                    teamnames.Add(t.TeamName);
                }
            }

            other = MainForm.l.getTeambyTeamName(teamnames.ElementAt(rnd.Next(teamnames.Count)));
            tosell = playerteam.getPlayer(rnd.Next(playerteam.NumbOfPlayers));

            InitializeComponent();
        }
        private Player choosePlayer(Team cteam)
        {
            int n;
            try
            {
                n = int.Parse(Console.ReadLine());
                if (n > otherst.Count)
                {
                    throw new Exception();
                }

                if (n < 1)
                {
                    throw new Exception();
                }
            }
            catch (Exception e)
            {
                n = 1;
            }

            return cteam.getPlayer(n - 1);
        }