public ViewModelConquer( ResourceConquer resourceConquer, ResourcePlayer resourcePlayer) { _resourceConquer = resourceConquer; _resourcePlayer = resourcePlayer; ConquerCollection = CollectionViewSource.GetDefaultView(_resourceConquer.GetConquerList().OrderByDescending(x => x.Time)); //ConquerCollection.Filter = new Predicate<object>( Filter ); }
/// <summary> /// Generate Player Ranking with join resources, combine them. /// </summary> /// <returns>object / IEnumerable</returns> public object CreatePlayerRanking() => from p in _resourcePlayer.GetPlayerList( ) join a in _resourceAlly.GetAllyList( ) on p.Ally equals a.Id join att in _resourceBashpointPlayer.GetBashpointAttList() on p.Id equals att.Id join def in _resourceBashpointPlayer.GetBashpointDefList() on p.Id equals def.Id join all in _resourceBashpointPlayer.GetBashpointAllList() on p.Id equals all.Id join con in _resourceConquer.GetConquerList() on p.Id equals con.NewOwner into conquerList orderby p.Points descending select new { p.Rank, p.Name, a.Tag, p.Villages, p.Points, p.PointsVillage, BashpointAtt = att.Kills, BashpointDef = def.Kills, BashpointAll = all.Kills, BashpointSup = all.Kills - (att.Kills + def.Kills), Barbs = conquerList.Where(p => p.OldOwner.Equals(0)).Count() };