public void FilterByPlayerYearNbPlayers(string player, string year, string nbPlayers) { AllPlaysByYear = new ObservableCollection <Play>(AllPlays); if (year != ALL_YEARS) { AllPlaysByYear = new ObservableCollection <Play>(AllPlaysByYear.Where(p => p.Date.Year.Equals(Int32.Parse(year)))); //Assume that there are only numbers! for years... } if (!String.IsNullOrEmpty(player)) { AllPlaysByYear = new ObservableCollection <Play>(AllPlaysByYear.Where(p => p.Result.Any(r => r.Player.Nickname == player))); } if (nbPlayers != null) { AllPlaysByYear = new ObservableCollection <Play>(AllPlaysByYear.Where(p => p.Result.Count == Int32.Parse(nbPlayers))); //Assume that there are only numbers! for number of players... } CalculGamesAndLocationCounts(); }
public void ResetPlays() { AllPlaysByYear.Clear(); }