示例#1
0
 public Player(Knjiznica.Model.Player player, Matches match)
 {
     this.match  = match;
     this.player = player;
     InitializeComponent();
     SetPlayer(player, match);
 }
        private void SetStats(Knjiznica.Model.Player player, ImageSource source, Matches match)
        {
            pImage.Source     = source;
            pName.Content     = player.Name;
            pNumber.Content   = $"{Properties.Resources.pNumber}{player.Number}";
            pPosition.Content = player.Position;
            pRole.Content     = $"{Properties.Resources.pCaptain}{((player.IsCaptain == true) ? Properties.Resources.pYes : Properties.Resources.pNo)}";


            int yellowCardsCount = 0;
            int goalsScoredCount = 0;

            foreach (var other in match.Home_Team_Statistics.Starting_Eleven)
            {
                if (other.Name == player.Name)
                {
                    foreach (var evt in match.Home_Team_Events)
                    {
                        if (evt.EventType == "yellow-card" && evt.PlayerName == player.Name)
                        {
                            yellowCardsCount++;
                        }
                        if (evt.EventType == "goal-penalty" && evt.PlayerName == player.Name ||
                            evt.EventType == "goal-own" && evt.PlayerName == player.Name ||
                            evt.EventType == "goal" && evt.PlayerName == player.Name)
                        {
                            goalsScoredCount++;
                        }
                    }
                }
            }
            foreach (var other in match.Away_Team_Statistics.Starting_Eleven)
            {
                if (other.Name == player.Name)
                {
                    foreach (var evt in match.Away_Team_Events)
                    {
                        if (evt.EventType == "yellow-card" && evt.PlayerName == player.Name)
                        {
                            yellowCardsCount++;
                        }
                        if (evt.EventType == "goal-penalty" && evt.PlayerName == player.Name ||
                            evt.EventType == "goal-own" && evt.PlayerName == player.Name ||
                            evt.EventType == "goal" && evt.PlayerName == player.Name)
                        {
                            goalsScoredCount++;
                        }
                    }
                }
            }

            pGoalsScored.Content = $"{Properties.Resources.pGoals}{goalsScoredCount}";
            pYellowCards.Content = $"{Properties.Resources.pCards}{yellowCardsCount}";
        }
示例#3
0
        private void SetPlayer(Knjiznica.Model.Player player, Matches match)
        {
            System.Drawing.Bitmap image;
            image = FileRepo.LoadPlayerPictureFromCache(player.Name, FileRepo.playerPicturesPath);

            if (image == null)
            {
                image = Properties.Resources.p5;
            }
            // pImage.Source = MainWindow.BitmapToImageSource(image);
            pNumber.Text = player.Number.ToString();
            pName.Text   = player.Name;
        }
示例#4
0
        private void AddPlayerCount(Knjiznica.Model.Player player)
        {
            switch (player.Position)
            {
            case "Defender":
                defenderPlayerCount++;
                break;

            case "Midfield":
                midfilderPlayerCount++;
                break;

            case "Forward":
                forwardPlayerCount++;
                break;
            }
        }
示例#5
0
        private void PlacePlayer(Knjiznica.Model.Player player, int column, int index, int playerCount, Matches match)
        {
            UserControl temp = new Player(player, match);

            temp.HorizontalAlignment = HorizontalAlignment.Center;
            temp.VerticalAlignment   = VerticalAlignment.Center;

            Grid.SetColumn(temp, column);
            if (player.Position == "Goalie")
            {
                Grid.SetRow(temp, 1);
                Grid.SetRowSpan(temp, 3);
            }
            else
            {
                Grid.SetRow(temp, playerCount - 1);
            }
            gPlayers.Children.Add(temp);
        }
示例#6
0
        private void DrawPlayers(Knjiznica.Model.Player player, int from, int playerIndex, Matches match)
        {
            switch (player.Position)
            {
            case "Goalie":
                PlacePlayer(player, (from == 0) ? 0 : 7, playerIndex, 0, match);
                break;

            case "Defender":
                PlacePlayer(player, (from == 0) ? 1 : 6, playerIndex, defenderPlayerCount, match);
                defenderPlayerCount--;
                break;

            case "Midfield":
                PlacePlayer(player, (from == 0) ? 2 : 5, playerIndex, midfilderPlayerCount, match);
                midfilderPlayerCount--;
                break;

            case "Forward":
                PlacePlayer(player, (from == 0) ? 3 : 4, playerIndex, forwardPlayerCount, match);
                forwardPlayerCount--;
                break;
            }
        }
 public PlayerStats(Knjiznica.Model.Player player, ImageSource source, Matches match)
 {
     //  Thread.CurrentThread.CurrentUICulture = new System.Globalization.CultureInfo(filere.ApplicationLanguage);
     InitializeComponent();
     SetStats(player, source, match);
 }