public void RefreshResults() { var list = new List <BookmarkListItem>(); if (Binding.Value != null && Binding.Value.Avatar_BookmarksVec != null) { var bookmarks = Binding.Value.Avatar_BookmarksVec.Where(x => x.Bookmark_Type == (byte)CurrentType).ToList(); var enriched = DataService.EnrichList <BookmarkListItem, Bookmark, Avatar>(bookmarks, x => x.Bookmark_TargetID, (bookmark, avatar) => { return(new BookmarkListItem { Avatar = avatar, Bookmark = bookmark }); }); list = enriched; } View.SetResults(list); }
public void RefreshResults() { var list = new List <Avatar>(); if (Binding.Value != null && Binding.Value.Lot_LotAdmitInfo?.LotAdmitInfo_AdmitList != null) { List <uint> source; if (ShowBans) { source = Binding.Value.Lot_LotAdmitInfo.LotAdmitInfo_BanList.ToList(); } else { source = Binding.Value.Lot_LotAdmitInfo.LotAdmitInfo_AdmitList.ToList(); } list = DataService.EnrichList <Avatar, uint, Avatar>(source, x => x, (avatarid, avatar) => { return(avatar); }); } View.SetResults(list); }
public void SetCategory(Top100Category category) { Category = category; if (category.IsLotCategory()) { LastLotCategory = category; } else { LastAvatarCategory = category; } View.SelectCategory(category); DatabaseService.GetTop100(new GetTop100Request() { Category = category }) .ContinueWith(x => { //Category has been switched if (Category != category) { return; } List <Top100ListItem> enriched = null; if (category.IsLotCategory()) { enriched = DataService.EnrichList <Top100ListItem, Top100Entry, Lot>(x.Result.Items, y => y.TargetId, (top100Entry, lot) => { return(new Top100ListItem() { Top100Entry = top100Entry, Lot = lot }); }); } else { enriched = DataService.EnrichList <Top100ListItem, Top100Entry, Avatar>(x.Result.Items, z => z.TargetId, (top100Entry, avatar) => { return(new Top100ListItem() { Top100Entry = top100Entry, Avatar = avatar }); }); } //Fill in any gaps while (enriched.Count < 100) { enriched.Add(new Top100ListItem { Top100Entry = new Top100Entry() { Rank = (byte)(enriched.Count + 1) } }); } enriched = enriched.OrderBy(i => i.Top100Entry.Rank).ToList(); View.DisplayResults(enriched); }); }