Exemplo n.º 1
0
        private void lbPosjecenost_SelectedIndexChanged(object sender, EventArgs e)
        {
            Posjećenost p = lbPosjecenost.SelectedItem as Posjećenost;

            tBoxVenue.Text      = p.venue;
            tBoxAttendance.Text = p.attendance.ToString();
            tBoxHome.Text       = p.home_team_country;
            tBoxAway.Text       = p.away_team_country;
        }
Exemplo n.º 2
0
        private async void LoadData(List <StartingEleven> igraci)
        {
            var team = await GetData();

            int golovi = 0;
            int zuti   = 0;

            //GOLOVI
            foreach (var igrac in igraci)
            {
                for (int i = 0; i < team.Count(); i++)
                {
                    for (int j = 0; j < team[i].HomeTeamEvents.Count(); j++)
                    {
                        if (team[i].HomeTeamEvents[j].TypeOfEvent == TypeOfEvent.Goal || team[i].HomeTeamEvents[j].TypeOfEvent == TypeOfEvent.GoalPenalty)
                        {
                            if (team[i].HomeTeamEvents[j].Player == igrac.Name)
                            {
                                golovi++;
                            }
                        }
                    }
                    for (int j = 0; j < team[i].AwayTeamEvents.Count(); j++)
                    {
                        if (team[i].AwayTeamEvents[j].TypeOfEvent == TypeOfEvent.Goal || team[i].AwayTeamEvents[j].TypeOfEvent == TypeOfEvent.GoalPenalty)
                        {
                            if (team[i].AwayTeamEvents[j].Player == igrac.Name)
                            {
                                golovi++;
                            }
                        }
                    }
                }
                igracGol.Add(igrac, golovi);
                golovi = 0;
            }
            GetDictionaryGolovi();

            //ZUTI KARTONI
            foreach (var igrac in igraci)
            {
                for (int i = 0; i < team.Count(); i++)
                {
                    for (int j = 0; j < team[i].HomeTeamEvents.Count(); j++)
                    {
                        if (team[i].HomeTeamEvents[j].TypeOfEvent == TypeOfEvent.YellowCard || team[i].HomeTeamEvents[j].TypeOfEvent == TypeOfEvent.YellowCardSecond)
                        {
                            if (team[i].HomeTeamEvents[j].Player == igrac.Name)
                            {
                                zuti++;
                            }
                        }
                    }
                    for (int j = 0; j < team[i].AwayTeamEvents.Count(); j++)
                    {
                        if (team[i].AwayTeamEvents[j].TypeOfEvent == TypeOfEvent.YellowCard || team[i].AwayTeamEvents[j].TypeOfEvent == TypeOfEvent.YellowCardSecond)
                        {
                            if (team[i].AwayTeamEvents[j].Player == igrac.Name)
                            {
                                zuti++;
                            }
                        }
                    }
                }
                igracZutiKarton.Add(igrac, zuti);
                zuti = 0;
            }
            GetDictionaryZuti();

            //POSJEĆENOST
            List <Posjećenost> posjećenosts = new List <Posjećenost>();

            string[] lines = File.ReadAllLines(Path.Combine(Environment.CurrentDirectory, @"..\..\..\..\OdabranaNacija.txt"));
            string   line  = lines[0];

            string[] parts   = line.Split(' ');
            string   country = parts[0];

            foreach (var utakmica in team)
            {
                if (utakmica.HomeTeamCountry == country || utakmica.AwayTeamCountry == country)
                {
                    Posjećenost p = new Posjećenost
                    {
                        attendance        = utakmica.Attendance.Value,
                        venue             = utakmica.Venue,
                        home_team_country = utakmica.HomeTeamCountry,
                        away_team_country = utakmica.AwayTeamCountry
                    };
                    posjećenosts.Add(p);
                }
            }
            posjećenosts.Sort();
            foreach (var utakmica in posjećenosts)
            {
                lbPosjecenost.Items.Add(utakmica);
            }
        }