Esempio n. 1
0
        private void ClubIsSelected()
        {
            lbClub.Content    = club.name;
            lbStadium.Content = club.stadium.name + " (" + club.stadium.capacity + " " + FindResource("str_seats").ToString() + ")";
            lbBudget.Content  = FindResource("str_budget").ToString() + " : " + Utils.FormatMoney((club as CityClub).budget);
            lbCountry.Content = club.Country().Name();
            FillSquad(club);
            spEtoiles.Children.Clear();
            try
            {
                imgClub.Source = new BitmapImage(new Uri(Utils.Logo(club)));
            }
            catch
            {
                Utils.Debug("Pas de logo disponible pour " + club.logo);
            }

            spEtoiles.Children.Add(ViewUtils.CreateStarNotation(club.Stars, 25));
        }
Esempio n. 2
0
        private void FillNextMatchPanel()
        {
            spNextMatch.Children.Clear();

            Match next = Session.Instance.Game.club.NextGame;

            if (next != null)
            {
                //Create the 3 stacks panels
                StackPanel spHomeTeam = new StackPanel();
                spHomeTeam.Orientation         = Orientation.Vertical;
                spHomeTeam.HorizontalAlignment = HorizontalAlignment.Center;
                StackPanel spAwayTeam = new StackPanel();
                spAwayTeam.Orientation         = Orientation.Vertical;
                spAwayTeam.HorizontalAlignment = HorizontalAlignment.Center;
                StackPanel spInfos = new StackPanel();
                spInfos.Orientation         = Orientation.Vertical;
                spInfos.HorizontalAlignment = HorizontalAlignment.Center;
                spInfos.Width = 150;

                //Infos stack panel
                Round      r   = next.Round;
                Tournament trn = r.Tournament;

                TextBox tbTournament = new TextBox();
                tbTournament.Text                = next.Round.Tournament.name;
                tbTournament.Style               = FindResource("StyleTextBox") as Style;
                tbTournament.IsEnabled           = false;
                tbTournament.FontSize            = 16;
                tbTournament.HorizontalAlignment = HorizontalAlignment.Center;
                tbTournament.Background          = (SolidColorBrush)(new BrushConverter().ConvertFrom(trn.color.ToHexa()));
                tbTournament.Foreground          = Brushes.AntiqueWhite;

                spInfos.Children.Add(tbTournament);
                spInfos.Children.Add(ViewUtils.CreateLabel(r.name, "StyleLabel2Center", -1, -1));
                spInfos.Children.Add(ViewUtils.CreateLabel(next.day.ToShortTimeString(), "StyleLabel2Center", -1, -1));
                spInfos.Children.Add(ViewUtils.CreateLabel(next.home.stadium.name, "StyleLabel2Center", -1, -1));

                //Home team stack panel
                spHomeTeam.Children.Add(ViewUtils.CreateLogo(next.home, 125, 125));
                Label homeLabel = ViewUtils.CreateLabel(next.home.shortName, "StyleLabel2Center", 16, -1);
                homeLabel.HorizontalAlignment = HorizontalAlignment.Center;
                spHomeTeam.Children.Add(homeLabel);
                StackPanel homeStars = ViewUtils.CreateStarNotation(next.home.Stars, 25);
                homeStars.HorizontalAlignment = HorizontalAlignment.Center;
                spHomeTeam.Children.Add(homeStars);

                //Away team stack panel
                spAwayTeam.Children.Add(ViewUtils.CreateLogo(next.away, 125, 125));
                Label awayLabel = ViewUtils.CreateLabel(next.away.shortName, "StyleLabel2Center", 16, -1);
                awayLabel.HorizontalAlignment = HorizontalAlignment.Center;
                spAwayTeam.Children.Add(awayLabel);
                StackPanel awayStars = ViewUtils.CreateStarNotation(next.away.Stars, 25);
                awayStars.HorizontalAlignment = HorizontalAlignment.Center;
                spAwayTeam.Children.Add(awayStars);

                spNextMatch.Children.Add(spHomeTeam);
                spNextMatch.Children.Add(spInfos);
                spNextMatch.Children.Add(spAwayTeam);
            }
        }
        public Windows_Joueur(Player joueur)
        {
            _player = joueur;
            InitializeComponent();
            imgBtnQuitter.Source = new BitmapImage(new Uri(System.IO.Directory.GetCurrentDirectory() + "\\" + Utils.imagesFolderName + "\\return.png"));
            lbJoueur.Content     = joueur.ToString();
            Club c = joueur.Club;

            if (c != null)
            {
                lbClub.Content = c.name;
                imgClub.Source = new BitmapImage(new Uri(Utils.Logo(c)));
            }
            else
            {
                lbClub.Content = "Libre";
            }
            lbAge.Content  = FindResource("str_born").ToString() + " " + joueur.birthday.ToShortDateString() + " (" + joueur.Age + " " + FindResource("yo").ToString() + ")";
            imgFlag.Source = new BitmapImage(new Uri(Utils.Flag(joueur.nationality)));

            ChartValues <int> niveaux = new ChartValues <int>();
            ChartValues <int> buts    = new ChartValues <int>();
            ChartValues <int> joues   = new ChartValues <int>();

            foreach (PlayerHistory hj in joueur.history)
            {
                niveaux.Add(hj.Level);
                buts.Add(hj.Goals);
                joues.Add(hj.GamesPlayed);
            }

            NiveauCollection = new SeriesCollection
            {
                new LineSeries
                {
                    Title  = FindResource("str_level").ToString(),
                    Values = niveaux,
                }
            };

            ButsCollection = new SeriesCollection
            {
                new LineSeries
                {
                    Title  = FindResource("str_goalsScored").ToString(),
                    Values = buts,
                }
            };

            MatchsCollection = new SeriesCollection
            {
                new LineSeries
                {
                    Title  = FindResource("str_matchPlayed").ToString(),
                    Values = joues,
                }
            };

            LabelsAnnees = new string[joueur.history.Count];
            int i = 0;

            foreach (PlayerHistory hj in joueur.history)
            {
                LabelsAnnees[i] = hj.Year.ToString();
                i++;
            }

            DataContext = this;

            FillPlayerHistory();
            FillPlayerGames();
            lbValue.Content = FindResource("str_value").ToString() + " : " + Utils.FormatMoney(_player.EstimateTransferValue());
            Contract ct = _player.Club == null ? null : _player.Club.FindContract(_player);

            if (ct != null)
            {
                lbContract.Content = FindResource("str_underContractUntil").ToString() + " " + ct.end.ToShortDateString() + " (" + FindResource("str_wageOf").ToString() + " " + Utils.FormatMoney(ct.wage) + " /m)";
            }
            else
            {
                lbContract.Content = FindResource("str_noClub").ToString();
            }
            spLevel.Children.Add(ViewUtils.CreateStarNotation(_player.Stars, 15));
            spPotentiel.Children.Add(ViewUtils.CreateStarNotation(_player.StarsPotential, 15));
        }