예제 #1
0
 private bool CheckIfHome(string code, MatchesPage.Match match)
 {
     try
     {
         if (match.HomeTeam.Code.Equals(code))
         {
             return(true);
         }
         else
         {
             return(false);
         }
     }
     catch (Exception ex)
     {
         Console.WriteLine(ex.Message);
         return(false);
     }
 }
예제 #2
0
 private void cbAwayTeam_SelectionChanged(object sender, SelectionChangedEventArgs e)
 {
     try
     {
         KeyValuePair <string, string> par1  = (KeyValuePair <string, string>)cbAwayTeam.SelectedItem;
         KeyValuePair <string, string> par2  = (KeyValuePair <string, string>)cbHomeTeam.SelectedItem;
         MatchesPage.Match             match = APIParser.getSpecificMatch(par1.Value.ToString(), par2.Value.ToString());
         lblAwayGoal.Content = match.AwayTeam.Goals.ToString();
         lblHomeGoal.Content = match.HomeTeam.Goals.ToString();
         ClearAwayTeam();
         ClearHomeTeam();
         PlayersToField(match.HomeTeamStatistics.StartingEleven, true);
         PlayersToField(match.AwayTeamStatistics.StartingEleven, false);
     }
     catch (Exception ex)
     {
         MessageBox.Show(ex.Message.ToString());
     }
 }
예제 #3
0
 private void FillPlayersAndFavourite(List <StartingEleven> allPlayers, bool favourite)
 {
     MatchesPage.Match matchOne = APIParser.ParseMatches(GetPage(), GetCode()).FirstOrDefault();
     if (CheckIfHome(GetCode(), matchOne))
     {
         foreach (MatchesPage.StartingEleven player in matchOne.HomeTeamStatistics.StartingEleven)
         {
             if ((player.Favourite == favourite) || (player.Favourite.HasValue == favourite))
             {
                 allPlayers.Add(player);
             }
         }
         foreach (MatchesPage.StartingEleven player in matchOne.HomeTeamStatistics.Substitutes)
         {
             if ((player.Favourite == favourite) || (player.Favourite.HasValue == favourite))
             {
                 allPlayers.Add(player);
             }
         }
     }
     else
     {
         foreach (MatchesPage.StartingEleven player in matchOne.AwayTeamStatistics.StartingEleven)
         {
             if ((player.Favourite == favourite) || (player.Favourite.HasValue == favourite))
             {
                 allPlayers.Add(player);
             }
         }
         foreach (MatchesPage.StartingEleven player in matchOne.AwayTeamStatistics.Substitutes)
         {
             if ((player.Favourite == favourite) || (player.Favourite.HasValue == favourite))
             {
                 allPlayers.Add(player);
             }
         }
     }
 }