private StackPanel CreateRanking(int index, Club c)
        {
            StackPanel sp = new StackPanel();

            sp.Orientation = Orientation.Horizontal;

            int fontBase = (int)(14 * _sizeMultiplier);

            sp.Children.Add(ViewUtils.CreateLabel(index.ToString(), "StyleLabel2", fontBase, 30));
            if (_round.Tournament.IsInternational() && (c as CityClub) != null)
            {
                sp.Children.Add(ViewUtils.CreateFlag((c as CityClub).city.Country(), 30 * _sizeMultiplier, 30 * _sizeMultiplier));
            }
            else if (_round.Tournament.IsInternational() && (c as ReserveClub) != null)
            {
                sp.Children.Add(ViewUtils.CreateFlag((c as ReserveClub).FannionClub.city.Country(), 30 * _sizeMultiplier, 30 * _sizeMultiplier));
            }
            else
            {
                sp.Children.Add(ViewUtils.CreateLogo(c, 30 * _sizeMultiplier, 30 * _sizeMultiplier));
            }


            Label l2 = ViewUtils.CreateLabel(_round.Tournament.isChampionship ? c.extendedName : c.shortName, "StyleLabel2", fontBase, 150 * _sizeMultiplier);

            l2.MouseLeftButtonUp += (object sender, System.Windows.Input.MouseButtonEventArgs e) =>
            { clubNameButtonClick(c); };

            sp.Children.Add(l2);
            sp.Children.Add(ViewUtils.CreateLabel(_round.Points(c).ToString(), "StyleLabel2", fontBase, 25));
            sp.Children.Add(ViewUtils.CreateLabel(_round.Played(c).ToString(), "StyleLabel2", fontBase, 25));
            sp.Children.Add(ViewUtils.CreateLabel(_round.Wins(c).ToString(), "StyleLabel2", fontBase, 25));
            sp.Children.Add(ViewUtils.CreateLabel(_round.Draws(c).ToString(), "StyleLabel2", fontBase, 25));
            sp.Children.Add(ViewUtils.CreateLabel(_round.Loses(c).ToString(), "StyleLabel2", fontBase, 25));
            sp.Children.Add(ViewUtils.CreateLabel(_round.GoalsFor(c).ToString(), "StyleLabel2", fontBase, 25));
            sp.Children.Add(ViewUtils.CreateLabel(_round.GoalsAgainst(c).ToString(), "StyleLabel2", fontBase, 25));
            sp.Children.Add(ViewUtils.CreateLabel(_round.Difference(c).ToString(), "StyleLabel2", fontBase, 25));

            return(sp);
        }
Beispiel #2
0
        public override void Full(StackPanel spRanking)
        {
            this.spRanking = spRanking;
            spRanking.Children.Clear();

            StackPanel spLine = new StackPanel();

            spLine.Orientation = Orientation.Horizontal;
            spLine.Children.Add(ViewUtils.CreateLabelOpenWindow <PlayerAttribute>(PlayerAttribute.NAME, sortPlayers, spLine.FindResource("str_name").ToString(), "StyleLabel2", FontSize, 100));

            if (Position)
            {
                spLine.Children.Add(ViewUtils.CreateLabelOpenWindow <PlayerAttribute>(PlayerAttribute.POSITION, sortPlayers, "Pos", "StyleLabel2", FontSize, 30));
            }
            if (Age)
            {
                spLine.Children.Add(ViewUtils.CreateLabelOpenWindow <PlayerAttribute>(PlayerAttribute.AGE, sortPlayers, "Age", "StyleLabel2", FontSize, 60));
            }
            if (Level)
            {
                spLine.Children.Add(ViewUtils.CreateLabelOpenWindow <PlayerAttribute>(PlayerAttribute.LEVEL, sortPlayers, "GLO", "StyleLabel2", FontSize, LevelsInNumbers ? 40 : FontSize * 1.5f * 6));
            }
            if (Potential)
            {
                spLine.Children.Add(ViewUtils.CreateLabelOpenWindow <PlayerAttribute>(PlayerAttribute.POTENTIAL, sortPlayers, "Pot", "StyleLabel2", FontSize, LevelsInNumbers ? 40 : FontSize * 1.5f * 6));
            }
            if (Condition)
            {
                spLine.Children.Add(ViewUtils.CreateLabelOpenWindow <PlayerAttribute>(PlayerAttribute.CONDITION, sortPlayers, "Cond.", "StyleLabel2", FontSize, 40));
            }
            if (Nationality)
            {
                spLine.Children.Add(ViewUtils.CreateLabelOpenWindow <PlayerAttribute>(PlayerAttribute.NATIONALITY, sortPlayers, "Nat.", "StyleLabel2", FontSize, 40));
            }
            if (Value)
            {
                spLine.Children.Add(ViewUtils.CreateLabelOpenWindow <PlayerAttribute>(PlayerAttribute.VALUE, sortPlayers, "Value", "StyleLabel2", FontSize, 60));
            }
            if (Wage)
            {
                spLine.Children.Add(ViewUtils.CreateLabelOpenWindow <PlayerAttribute>(PlayerAttribute.WAGE, sortPlayers, "Wage", "StyleLabel2", FontSize, 60));
            }
            if (ContractBegin)
            {
                spLine.Children.Add(ViewUtils.CreateLabelOpenWindow <PlayerAttribute>(PlayerAttribute.CONTRACT_BEGIN, sortPlayers, "Begin", "StyleLabel2", FontSize, 80));
            }
            if (ContractEnd)
            {
                spLine.Children.Add(ViewUtils.CreateLabelOpenWindow <PlayerAttribute>(PlayerAttribute.CONTRACT_END, sortPlayers, "End", "StyleLabel2", FontSize, 80));
            }
            if (IsInjuried)
            {
                spLine.Children.Add(ViewUtils.CreateLabelOpenWindow <PlayerAttribute>(PlayerAttribute.IS_INJURIED, sortPlayers, "Inj.", "StyleLabel2", FontSize, 30));
            }
            if (Games)
            {
                spLine.Children.Add(ViewUtils.CreateLabelOpenWindow <PlayerAttribute>(PlayerAttribute.GAMES, sortPlayers, "Games", "StyleLabel2", FontSize, 50));
            }
            if (Goals)
            {
                spLine.Children.Add(ViewUtils.CreateLabelOpenWindow <PlayerAttribute>(PlayerAttribute.GOALS, sortPlayers, "Goals", "StyleLabel2", FontSize, 50));
            }
            if (IsSuspended)
            {
                spLine.Children.Add(ViewUtils.CreateLabelOpenWindow <PlayerAttribute>(PlayerAttribute.IS_SUSPENDED, sortPlayers, "Sus", "StyleLabel2", FontSize, 30));
            }
            if (IsInternational)
            {
                spLine.Children.Add(ViewUtils.CreateLabelOpenWindow <PlayerAttribute>(PlayerAttribute.IS_INTERNATIONAL, sortPlayers, "Int.", "StyleLabel2", FontSize, 30));
            }
            if (InternationalSelections)
            {
                spLine.Children.Add(ViewUtils.CreateLabelOpenWindow <PlayerAttribute>(PlayerAttribute.INTERNATIONAL_SELECTIONS, sortPlayers, "Int. S", "StyleLabel2", FontSize, 50));
            }
            if (InternationalGoals)
            {
                spLine.Children.Add(ViewUtils.CreateLabelOpenWindow <PlayerAttribute>(PlayerAttribute.INTERNATIONAL_GOALS, sortPlayers, "Int. G", "StyleLabel2", FontSize, 50));
            }

            spRanking.Children.Add(spLine);

            foreach (Player player in Players)
            {
                StackPanel spPlayer = new StackPanel();
                spPlayer.Orientation = Orientation.Horizontal;
                spPlayer.Children.Add(ViewUtils.CreateLabelOpenWindow <Player>(player, OpenPlayer, player.Name, "StyleLabel2", FontSize, 100));

                if (Position)
                {
                    spPlayer.Children.Add(ViewUtils.CreateLabel(ViewUtils.PlayerPositionOneLetter(player), "StyleLabel2", FontSize, 30));
                }
                if (Age)
                {
                    spPlayer.Children.Add(ViewUtils.CreateLabel(player.Age + " " + spLine.FindResource("str_yo").ToString(), "StyleLabel2", FontSize, 60));
                }
                if (Level)
                {
                    if (!LevelsInNumbers)
                    {
                        spPlayer.Children.Add(ViewUtils.CreateStarNotation(player.Stars, FontSize * 1.5f));
                    }
                    else
                    {
                        spPlayer.Children.Add(ViewUtils.CreateLabel(player.level.ToString(), "StyleLabel2", FontSize, 40, null, null, true));
                    }
                }
                if (Potential)
                {
                    if (!LevelsInNumbers)
                    {
                        spPlayer.Children.Add(ViewUtils.CreateStarNotation(player.StarsPotential, FontSize * 1.5f));
                    }
                    else
                    {
                        spPlayer.Children.Add(ViewUtils.CreateLabel(player.potential.ToString(), "StyleLabel2", FontSize, 40));
                    }
                }
                if (Condition)
                {
                    ProgressBar pb = ViewUtils.CreateProgressBar(player.energy, 0, 100, 40, 10);
                    spPlayer.Children.Add(pb);
                }
                if (Nationality)
                {
                    spPlayer.Children.Add(ViewUtils.CreateFlag(player.nationality, 30, 15));
                }
                if (Value)
                {
                    spPlayer.Children.Add(ViewUtils.CreateLabel(Utils.FormatMoney(player.EstimateTransferValue()), "StyleLabel2", FontSize, 60));
                }
                if (Wage)
                {
                    string wageStr = player.Club != null?Utils.FormatMoney(player.Club.FindContract(player).wage) + "/m" : "-";

                    spPlayer.Children.Add(ViewUtils.CreateLabel(wageStr, "StyleLabel2", FontSize, 60));
                }
                if (ContractBegin)
                {
                    string contractBegin = player.Club != null?player.Club.FindContract(player).beginning.ToShortDateString() : "-";

                    spPlayer.Children.Add(ViewUtils.CreateLabel(contractBegin, "StyleLabel2", FontSize, 80));
                }
                if (ContractEnd)
                {
                    string contractEnd = player.Club != null?player.Club.FindContract(player).end.ToShortDateString() : "-";

                    spPlayer.Children.Add(ViewUtils.CreateLabel(contractEnd, "StyleLabel2", FontSize, 80));
                }
                if (IsInjuried)
                {
                    throw new NotImplementedException();
                }
                if (Games)
                {
                    spPlayer.Children.Add(ViewUtils.CreateLabel(player.playedGames.ToString(), "StyleLabel2", FontSize, 50));
                }
                if (Goals)
                {
                    spPlayer.Children.Add(ViewUtils.CreateLabel(player.goalsScored.ToString(), "StyleLabel2", FontSize, 50));
                }
                if (IsSuspended)
                {
                    throw new NotImplementedException();
                }
                if (IsInternational)
                {
                    throw new NotImplementedException();
                }
                if (InternationalSelections)
                {
                    throw new NotImplementedException();
                }
                if (InternationalGoals)
                {
                    throw new NotImplementedException();
                }

                spRanking.Children.Add(spPlayer);
            }
        }
Beispiel #3
0
        public override void Full(StackPanel spRanking)
        {
            spRanking.Children.Clear();

            int i = 0;

            List <Club> clubs = _round.Ranking(_rankingType);

            //If we choose to focus on a team, we center the ranking on the team and +-2 other teams around
            int indexTeam = -1;

            if (_focusOnTeam && _team != null)
            {
                clubs = new List <Club>();
                List <Club> ranking = _round.Ranking();
                int         index   = ranking.IndexOf(Session.Instance.Game.club);
                index = index - 2;
                if (index < 0)
                {
                    index = 0;
                }
                if (index > ranking.Count - 5)
                {
                    index = ranking.Count - 5;
                }
                i = index;
                for (int j = index; j < index + 5; j++)
                {
                    Club c = ranking[j];
                    clubs.Add(c);
                    if (c == Session.Instance.Game.club)
                    {
                        indexTeam = j - index;
                    }
                }
            }

            double fontSize         = (double)Application.Current.FindResource("TailleMoyenne");
            double regularCellWidth = 36 * _sizeMultiplier;

            StackPanel spTitle = new StackPanel();

            spTitle.Orientation = Orientation.Horizontal;
            spTitle.Children.Add(ViewUtils.CreateLabel("", "StyleLabel2", fontSize * _sizeMultiplier, regularCellWidth / 1.25 + regularCellWidth / 1.5 + regularCellWidth * 3.5));
            spTitle.Children.Add(ViewUtils.CreateLabel("Pts", "StyleLabel2Center", fontSize * _sizeMultiplier, regularCellWidth));
            spTitle.Children.Add(ViewUtils.CreateLabel("J", "StyleLabel2Center", fontSize * _sizeMultiplier, regularCellWidth));
            if (!_reduced)
            {
                spTitle.Children.Add(ViewUtils.CreateLabel("G", "StyleLabel2Center", fontSize * _sizeMultiplier, regularCellWidth));
                spTitle.Children.Add(ViewUtils.CreateLabel("N", "StyleLabel2Center", fontSize * _sizeMultiplier, regularCellWidth));
                spTitle.Children.Add(ViewUtils.CreateLabel("P", "StyleLabel2Center", fontSize * _sizeMultiplier, regularCellWidth));
                spTitle.Children.Add(ViewUtils.CreateLabel("p.", "StyleLabel2Center", fontSize * _sizeMultiplier, regularCellWidth));
                spTitle.Children.Add(ViewUtils.CreateLabel("c.", "StyleLabel2Center", fontSize * _sizeMultiplier, regularCellWidth));
            }
            spTitle.Children.Add(ViewUtils.CreateLabel("Diff", "StyleLabel2Center", fontSize * _sizeMultiplier, regularCellWidth * 1.25));
            spRanking.Children.Add(spTitle);

            foreach (Club c in clubs)
            {
                i++;
                StackPanel sp = new StackPanel();
                sp.Orientation = Orientation.Horizontal;


                sp.Children.Add(ViewUtils.CreateLabel(i.ToString(), "StyleLabel2", fontSize * _sizeMultiplier, regularCellWidth / 1.25));


                if (_round.Tournament.IsInternational() && (c as CityClub) != null)
                {
                    sp.Children.Add(ViewUtils.CreateFlag((c as CityClub).city.Country(), regularCellWidth / 1.5, regularCellWidth / 1.5));
                }
                else if (_round.Tournament.IsInternational() && (c as ReserveClub) != null)
                {
                    sp.Children.Add(ViewUtils.CreateFlag((c as ReserveClub).FannionClub.city.Country(), regularCellWidth / 1.5, regularCellWidth / 1.5));
                }
                else
                {
                    sp.Children.Add(ViewUtils.CreateLogo(c, regularCellWidth / 1.5, regularCellWidth / 1.5));
                }

                sp.Children.Add(ViewUtils.CreateLabelOpenWindow <Club>(c, OpenClub, _round.Tournament.isChampionship ? c.extendedName : c.shortName, "StyleLabel2", fontSize * _sizeMultiplier, regularCellWidth * 3.5));
                sp.Children.Add(ViewUtils.CreateLabel(_round.Points(c, _rankingType).ToString(), "StyleLabel2", fontSize * _sizeMultiplier, regularCellWidth, null, null, true));
                sp.Children.Add(ViewUtils.CreateLabel(_round.Played(c, _rankingType).ToString(), "StyleLabel2", fontSize * _sizeMultiplier, regularCellWidth));
                if (!_reduced)
                {
                    sp.Children.Add(ViewUtils.CreateLabel(_round.Wins(c, _rankingType).ToString(), "StyleLabel2", fontSize * _sizeMultiplier, regularCellWidth));
                    sp.Children.Add(ViewUtils.CreateLabel(_round.Draws(c, _rankingType).ToString(), "StyleLabel2", fontSize * _sizeMultiplier, regularCellWidth));
                    sp.Children.Add(ViewUtils.CreateLabel(_round.Loses(c, _rankingType).ToString(), "StyleLabel2", fontSize * _sizeMultiplier, regularCellWidth));
                    sp.Children.Add(ViewUtils.CreateLabel(_round.GoalsFor(c, _rankingType).ToString(), "StyleLabel2", fontSize * _sizeMultiplier, regularCellWidth));
                    sp.Children.Add(ViewUtils.CreateLabel(_round.GoalsAgainst(c, _rankingType).ToString(), "StyleLabel2", fontSize * _sizeMultiplier, regularCellWidth));
                }
                sp.Children.Add(ViewUtils.CreateLabel(_round.Difference(c, _rankingType).ToString(), "StyleLabel2", fontSize * _sizeMultiplier, regularCellWidth * 1.25));

                spRanking.Children.Add(sp);
            }

            //Only show colors when the ranking is not focused on a team
            if (!_focusOnTeam)
            {
                Club          cupWinner       = (Session.Instance.Game.kernel.LocalisationTournament(_round.Tournament) as Country)?.Cup(1)?.Winner();
                int           roundLevel      = _round.Tournament.level;
                ILocalisation localisation    = Session.Instance.Game.kernel.LocalisationTournament(_round.Tournament);
                Country       country         = localisation as Country;
                List <Club>   registeredClubs = new List <Club>();
                if (country != null && roundLevel == 1)
                {
                    Continent continent      = country.Continent;
                    int       nationIndex    = continent.associationRanking.IndexOf(country) + 1;
                    int       currentRanking = 0;
                    int       totalQualificationsFromLeague = (from qualification in continent.continentalQualifications where (qualification.ranking == nationIndex && !qualification.isNextYear) select qualification.qualifies).Sum();

                    foreach (Qualification q in continent.continentalQualifications)
                    {
                        //q.isNextYear refeer to cup winner qualification for continental competition
                        if (q.ranking == nationIndex && (!q.isNextYear || registeredClubs.Contains(cupWinner)))
                        {
                            for (int j = 0; j < q.qualifies; j++)
                            {
                                registeredClubs.Add(clubs[currentRanking]);
                                string          color     = QualificationColor(q);
                                SolidColorBrush lineColor = Application.Current.TryFindResource(color) as SolidColorBrush;
                                (spRanking.Children[currentRanking + 1] as StackPanel).Background = lineColor;
                                currentRanking++;
                            }
                        }
                        else if (q.ranking == nationIndex && q.isNextYear && clubs.Contains(cupWinner))
                        {
                            string          color     = QualificationColor(q);
                            SolidColorBrush lineColor = Application.Current.TryFindResource(color) as SolidColorBrush;
                            (spRanking.Children[clubs.IndexOf(cupWinner) + 1] as StackPanel).Background = lineColor;
                        }
                    }
                }
                foreach (Qualification q in _round.qualifications)
                {
                    string color = "backgroundColor";
                    if (q.tournament.isChampionship)
                    {
                        if (q.tournament.level < roundLevel)
                        {
                            color = "promotionColor";
                        }
                        else if (q.tournament.level > roundLevel)
                        {
                            color = "relegationColor";
                        }
                        else if (q.tournament.level == roundLevel && q.roundId > _round.Tournament.rounds.IndexOf(_round))
                        {
                            color = "barrageColor";
                        }
                    }
                    else if (q.tournament.IsInternational())
                    {
                        if (q.tournament.level == 1 && q.tournament.rounds[q.roundId] as GroupsRound != null)
                        {
                            color = "cl1Color";
                        }
                        else if (q.tournament.level == 1)
                        {
                            color = "cl2Color";
                        }
                        else if (q.tournament.level == 2 && q.tournament.rounds[q.roundId] as GroupsRound != null)
                        {
                            color = "el1Color";
                        }
                        else if (q.tournament.level == 2)
                        {
                            color = "el2Color";
                        }
                        else if (q.tournament.level == 3)
                        {
                            color = "el3Color";
                        }
                    }
                    int index = q.ranking;
                    if (color != "backgroundColor" && clubs.Count > 0)
                    {
                        SolidColorBrush lineColor = Application.Current.TryFindResource(color) as SolidColorBrush;
                        (spRanking.Children[index] as StackPanel).Background = lineColor;
                    }
                }
            }
            else
            {
                SolidColorBrush color = new SolidColorBrush((System.Windows.Media.Color)Application.Current.TryFindResource("ColorDate"));
                color.Opacity = 0.6;
                (spRanking.Children[indexTeam + 1] as StackPanel).Background = color;
            }
        }
Beispiel #4
0
        public override void Full(StackPanel spRanking)
        {
            float sizeMultiplier = fontSize / 12;

            panel = spRanking;
            panel.Children.Clear();

            DateTime   lastTime          = new DateTime(2000, 1, 1);
            Tournament currentTournament = null;

            foreach (Match match in matches)
            {
                if (showDateSeparated && lastTime != match.day.Date)
                {
                    if (showDate)
                    {
                        StackPanel spDate = new StackPanel();
                        spDate.Orientation = Orientation.Horizontal;
                        CultureInfo ci = new CultureInfo("en-EN");
                        spDate.Children.Add(ViewUtils.CreateLabel(match.day.Date.ToString("dddd dd MMMM yyyy", ci), "StyleLabel2", fontSize, -1));
                        panel.Children.Add(spDate);
                    }
                }
                lastTime = match.day.Date;

                if (showHourSeparated)
                {
                    StackPanel spHourLine = new StackPanel();
                    spHourLine.Orientation         = Orientation.Horizontal;
                    spHourLine.HorizontalAlignment = HorizontalAlignment.Center;
                    spHourLine.Children.Add(ViewUtils.CreateLabel(match.day.ToShortTimeString(), "StyleLabel2Center", fontSize * 0.7, 50 * sizeMultiplier));
                    panel.Children.Add(spHourLine);
                }

                if (showTournamentSeparated && currentTournament != match.Tournament)
                {
                    StackPanel spTournamentLine = new StackPanel();
                    spTournamentLine.Orientation = Orientation.Horizontal;
                    Country tournamentCountry = Session.Instance.Game.kernel.LocalisationTournament(match.Tournament) as Country;
                    if (tournamentCountry != null)
                    {
                        spTournamentLine.Children.Add(ViewUtils.CreateFlag(tournamentCountry, 30 * sizeMultiplier, 20 * sizeMultiplier));
                    }
                    spTournamentLine.Children.Add(ViewUtils.CreateLabel(match.Tournament.name, "StyleLabel2", fontSize, 175 * sizeMultiplier));
                    panel.Children.Add(spTournamentLine);
                }

                StackPanel spLine = new StackPanel();
                spLine.Orientation = Orientation.Horizontal;

                if (!showDateSeparated && showDate)
                {
                    spLine.Children.Add(ViewUtils.CreateLabel(match.day.ToString("dd/MM"), "StyleLabel2", fontSize * 0.9, 40 * sizeMultiplier));
                }
                if (showHour && !showHourSeparated)
                {
                    spLine.Children.Add(ViewUtils.CreateLabel(match.day.ToShortTimeString(), "StyleLabel2", fontSize * 0.9, 35 * sizeMultiplier));
                }
                if (showTournament && !showTournamentSeparated)
                {
                    spLine.Children.Add(ViewUtils.CreateLabel(match.Tournament.shortName, "StyleLabel2", fontSize, 30 * sizeMultiplier, new SolidColorBrush(System.Windows.Media.Color.FromRgb(15, 15, 15)), new SolidColorBrush(System.Windows.Media.Color.FromRgb(match.Tournament.color.red, match.Tournament.color.green, match.Tournament.color.blue))));
                }

                if (!match.Round.Tournament.isChampionship)
                {
                    spLine.Children.Add(ViewUtils.CreateLabel(match.home.Championship != null ? match.home.Championship.shortName : "", "StyleLabel2Center", fontSize * 0.85, 20 * sizeMultiplier * widthMultiplier));
                }

                spLine.Children.Add(ViewUtils.CreateLabelOpenWindow <Club>(match.home, OpenClub, match.home.shortName, "StyleLabel2", fontSize * 0.85, 70 * sizeMultiplier * widthMultiplier));
                spLine.Children.Add(ViewUtils.CreateLogo(match.home, 20 * sizeMultiplier, 20 * sizeMultiplier));
                if (!beautifyScore)
                {
                    Label  labelScore = ViewUtils.CreateLabelOpenWindow <Match>(match, OpenMatch, match.ScoreToString(), "StyleLabel2Center", fontSize, 85 * sizeMultiplier);
                    string fontColor  = "defaiteColor";
                    if (colorizeResult)
                    {
                        if ((club == match.home && match.score1 > match.score2) || (club == match.away && match.score1 < match.score2))
                        {
                            fontColor = "victoireColor";
                        }
                        else if (match.score1 == match.score2)
                        {
                            fontColor = "nulColor";
                        }
                        SolidColorBrush color = Application.Current.TryFindResource(fontColor) as SolidColorBrush;
                        labelScore.Background = color;
                    }


                    spLine.Children.Add(labelScore);
                }
                else
                {
                    Border borderScore1 = new Border();
                    borderScore1.Style        = Application.Current.FindResource("StyleBorderCalendar") as Style;
                    borderScore1.Height       = fontSize * 2.25;
                    borderScore1.Width        = fontSize * 2.25;
                    borderScore1.CornerRadius = new CornerRadius(3);
                    borderScore1.Child        = ViewUtils.CreateLabelOpenWindow <Match>(match, OpenMatch, match.score1.ToString(), "StyleLabel2Center", fontSize, -1);
                    borderScore1.Margin       = new Thickness(fontSize / 2, 0, 0, 0);
                    Border borderScore2 = new Border();
                    borderScore2.Style        = Application.Current.FindResource("StyleBorderCalendar") as Style;
                    borderScore2.Height       = fontSize * 2.25;
                    borderScore2.Width        = fontSize * 2.25;
                    borderScore2.CornerRadius = new CornerRadius(3);
                    borderScore2.Child        = ViewUtils.CreateLabelOpenWindow <Match>(match, OpenMatch, match.score2.ToString(), "StyleLabel2Center", fontSize, -1);
                    borderScore2.Margin       = new Thickness(0, 0, fontSize / 2, 0);
                    spLine.Children.Add(borderScore1);
                    spLine.Children.Add(borderScore2);
                }

                spLine.Children.Add(ViewUtils.CreateLogo(match.away, 20 * sizeMultiplier, 20 * sizeMultiplier));
                spLine.Children.Add(ViewUtils.CreateLabelOpenWindow <Club>(match.away, OpenClub, match.away.shortName, "StyleLabel2Right", fontSize * 0.85, 70 * sizeMultiplier * widthMultiplier));

                if (!match.Round.Tournament.isChampionship)
                {
                    spLine.Children.Add(ViewUtils.CreateLabel(match.away.Championship != null ? match.away.Championship.shortName : "", "StyleLabel2Center", fontSize * 0.85, 20 * sizeMultiplier * widthMultiplier));
                }


                if (showAttendance)
                {
                    spLine.Children.Add(ViewUtils.CreateLabel(match.attendance.ToString(), "StyleLabel2", fontSize * 0.8, 40 * sizeMultiplier));
                }

                if (showOdds)
                {
                    spLine.Children.Add(ViewUtils.CreateLabel(match.odd1.ToString("0.00"), "StyleLabel2", fontSize * 0.75, 30 * sizeMultiplier));
                    spLine.Children.Add(ViewUtils.CreateLabel(match.oddD.ToString("0.00"), "StyleLabel2", fontSize * 0.75, 30 * sizeMultiplier));
                    spLine.Children.Add(ViewUtils.CreateLabel(match.odd2.ToString("0.00"), "StyleLabel2", fontSize * 0.75, 30 * sizeMultiplier));
                }

                panel.Children.Add(spLine);

                if (showHalfTimeScore)
                {
                    StackPanel spHalfTimeLine = new StackPanel();
                    spHalfTimeLine.Orientation         = Orientation.Horizontal;
                    spHalfTimeLine.HorizontalAlignment = HorizontalAlignment.Center;
                    spHalfTimeLine.Children.Add(ViewUtils.CreateLabel("(" + match.ScoreHalfTime1 + "-" + match.ScoreHalfTime2 + ")", "StyleLabel2Center", fontSize * 0.7, 50));
                    spHalfTimeLine.Margin = new Thickness(0, 0, 0, fontSize / 2);
                    panel.Children.Add(spHalfTimeLine);
                }

                currentTournament = match.Tournament;
            }
        }
Beispiel #5
0
        public override void Full(StackPanel spRanking)
        {
            spRanking.Children.Clear();
            List <Match> matchs = new List <Match>(_round.matches);

            matchs.Sort(new MatchDateComparator());

            bool internationalTournament = _round.Tournament.IsInternational();

            if (_round.twoLegs)
            {
                List <Match>[] pairs = new List <Match> [matchs.Count / 2];
                for (int i = 0; i < matchs.Count / 2; i++)
                {
                    pairs[i] = new List <Match>();
                }

                foreach (Match m in matchs)
                {
                    Utils.Debug(m.home.ToString() + " - " + m.away.ToString());
                    bool foundPair = false;
                    foreach (List <Match> pair in pairs)
                    {
                        if (pair.Count > 0 && pair[0].away == m.home)
                        {
                            pair.Add(m);
                            foundPair = true;
                        }
                    }
                    if (!foundPair)
                    {
                        int          i    = 0;
                        List <Match> pair = pairs[i];
                        while (pair.Count > 0)
                        {
                            pair = pairs[++i];
                        }
                        pair.Add(m);
                    }
                }

                foreach (List <Match> pair in pairs)
                {
                    StackPanel spFirstTeam = new StackPanel();
                    spFirstTeam.Orientation = Orientation.Horizontal;
                    StackPanel spSecondTeam = new StackPanel();
                    spSecondTeam.Orientation = Orientation.Horizontal;

                    if (internationalTournament)
                    {
                        spFirstTeam.Children.Add(ViewUtils.CreateFlag(pair[0].home.Country(), 15 * _sizeMultiplier, 15 * _sizeMultiplier));
                        spSecondTeam.Children.Add(ViewUtils.CreateFlag(pair[0].away.Country(), 15 * _sizeMultiplier, 15 * _sizeMultiplier));
                    }
                    else
                    {
                        spFirstTeam.Children.Add(ViewUtils.CreateLogo(pair[0].home, 15 * _sizeMultiplier, 15 * _sizeMultiplier));
                        spSecondTeam.Children.Add(ViewUtils.CreateLogo(pair[0].away, 15 * _sizeMultiplier, 15 * _sizeMultiplier));
                    }

                    if (!internationalTournament && !_round.Tournament.isChampionship)
                    {
                        spFirstTeam.Children.Add(ViewUtils.CreateLabel(pair[0].home.Championship.shortName, "StyleLabel2", 10 * _sizeMultiplier, 30 * _sizeMultiplier));
                        spSecondTeam.Children.Add(ViewUtils.CreateLabel(pair[0].away.Championship.shortName, "StyleLabel2", 10 * _sizeMultiplier, 30 * _sizeMultiplier));
                    }

                    spFirstTeam.Children.Add(ViewUtils.CreateLabel(pair[0].home.name, "StyleLabel2", 10 * _sizeMultiplier, 225 * _sizeMultiplier, null, null, pair[1].Winner == pair[0].home ? true : false));
                    spSecondTeam.Children.Add(ViewUtils.CreateLabel(pair[0].away.name, "StyleLabel2", 10 * _sizeMultiplier, 225 * _sizeMultiplier, null, null, pair[1].Winner == pair[0].away ? true : false));

                    spFirstTeam.Children.Add(ViewUtils.CreateLabel(pair[0].score1.ToString(), "StyleLabel2", 10 * _sizeMultiplier, 25 * _sizeMultiplier));
                    spSecondTeam.Children.Add(ViewUtils.CreateLabel(pair[0].score2.ToString(), "StyleLabel2", 10 * _sizeMultiplier, 25 * _sizeMultiplier));

                    spFirstTeam.Children.Add(ViewUtils.CreateLabel(pair[1].score2.ToString(), "StyleLabel2", 10 * _sizeMultiplier, 25 * _sizeMultiplier));
                    spSecondTeam.Children.Add(ViewUtils.CreateLabel(pair[1].score1.ToString(), "StyleLabel2", 10 * _sizeMultiplier, 25 * _sizeMultiplier));

                    if (pair[1].prolongations)
                    {
                        spFirstTeam.Children.Add(ViewUtils.CreateLabel(pair[1].Winner == pair[0].home ? "p." : "", "StyleLabel2", 10 * _sizeMultiplier, 25 * _sizeMultiplier));
                        spSecondTeam.Children.Add(ViewUtils.CreateLabel(pair[1].Winner != pair[0].home ? "p." : "", "StyleLabel2", 10 * _sizeMultiplier, 25 * _sizeMultiplier));
                    }

                    if (pair[1].PenaltyShootout)
                    {
                        spFirstTeam.Children.Add(ViewUtils.CreateLabel(pair[1].penaltyShootout2.ToString(), "StyleLabel2", 10 * _sizeMultiplier, 25 * _sizeMultiplier));
                        spSecondTeam.Children.Add(ViewUtils.CreateLabel(pair[1].penaltyShootout1.ToString(), "StyleLabel2", 10 * _sizeMultiplier, 25 * _sizeMultiplier));
                    }

                    spRanking.Children.Add(spFirstTeam);
                    spRanking.Children.Add(spSecondTeam);
                    spRanking.Children.Add(new Separator());
                }
            }
            else
            {
                foreach (Match m in matchs)
                {
                    StackPanel spFirstTeam = new StackPanel();
                    spFirstTeam.Orientation = Orientation.Horizontal;
                    StackPanel spSecondTeam = new StackPanel();
                    spSecondTeam.Orientation = Orientation.Horizontal;

                    if (internationalTournament)
                    {
                        spFirstTeam.Children.Add(ViewUtils.CreateFlag(m.home.Country(), 15 * _sizeMultiplier, 15 * _sizeMultiplier));
                        spSecondTeam.Children.Add(ViewUtils.CreateFlag(m.away.Country(), 15 * _sizeMultiplier, 15 * _sizeMultiplier));
                    }
                    else
                    {
                        spFirstTeam.Children.Add(ViewUtils.CreateLogo(m.home, 15 * _sizeMultiplier, 15 * _sizeMultiplier));
                        spSecondTeam.Children.Add(ViewUtils.CreateLogo(m.away, 15 * _sizeMultiplier, 15 * _sizeMultiplier));
                    }

                    if (!internationalTournament && !_round.Tournament.isChampionship)
                    {
                        spFirstTeam.Children.Add(ViewUtils.CreateLabel(m.home.Championship.shortName, "StyleLabel2", 10 * _sizeMultiplier, 30 * _sizeMultiplier));
                        spSecondTeam.Children.Add(ViewUtils.CreateLabel(m.away.Championship.shortName, "StyleLabel2", 10 * _sizeMultiplier, 30 * _sizeMultiplier));
                    }

                    spFirstTeam.Children.Add(ViewUtils.CreateLabel(m.home.name, "StyleLabel2", 10 * _sizeMultiplier, 225 * _sizeMultiplier, null, null, m.Winner == m.home ? true : false));
                    spSecondTeam.Children.Add(ViewUtils.CreateLabel(m.away.name, "StyleLabel2", 10 * _sizeMultiplier, 225 * _sizeMultiplier, null, null, m.Winner == m.away ? true : false));

                    spFirstTeam.Children.Add(ViewUtils.CreateLabel(m.score1.ToString(), "StyleLabel2", 10 * _sizeMultiplier, 25 * _sizeMultiplier));
                    spSecondTeam.Children.Add(ViewUtils.CreateLabel(m.score2.ToString(), "StyleLabel2", 10 * _sizeMultiplier, 25 * _sizeMultiplier));

                    if (m.prolongations)
                    {
                        spFirstTeam.Children.Add(ViewUtils.CreateLabel(m.Winner == m.home ? "p." : "", "StyleLabel2", 10 * _sizeMultiplier, 25 * _sizeMultiplier));
                        spSecondTeam.Children.Add(ViewUtils.CreateLabel(!(m.Winner == m.home) ? "p." : "", "StyleLabel2", 10 * _sizeMultiplier, 25 * _sizeMultiplier));
                    }

                    if (m.PenaltyShootout)
                    {
                        spFirstTeam.Children.Add(ViewUtils.CreateLabel(m.penaltyShootout1.ToString(), "StyleLabel2", 10 * _sizeMultiplier, 25 * _sizeMultiplier));
                        spSecondTeam.Children.Add(ViewUtils.CreateLabel(m.penaltyShootout2.ToString(), "StyleLabel2", 10 * _sizeMultiplier, 25 * _sizeMultiplier));
                    }

                    spRanking.Children.Add(spFirstTeam);
                    spRanking.Children.Add(spSecondTeam);
                    spRanking.Children.Add(new Separator());
                }
            }
        }