private void updateSearch() { queryChangedDebounce?.Cancel(); if (!IsLoaded) { return; } BeatmapSets = null; ResultAmounts = null; getSetsRequest?.Cancel(); if (api == null) { return; } if (Header.Tabs.Current.Value == DirectTab.Search && (Filter.Search.Text == string.Empty || currentQuery == string.Empty)) { return; } getSetsRequest = new GetBeatmapSetsRequest(currentQuery, ((FilterControl)Filter).Ruleset.Value, Filter.DisplayStyleControl.Dropdown.Current.Value, Filter.Tabs.Current.Value); //todo: sort direction (?) getSetsRequest.Success += r => { BeatmapSets = r?.Select(response => response.ToBeatmapSet(rulesets)); if (BeatmapSets == null) { return; } var artists = new List <string>(); var songs = new List <string>(); var tags = new List <string>(); foreach (var s in BeatmapSets) { artists.Add(s.Metadata.Artist); songs.Add(s.Metadata.Title); tags.AddRange(s.Metadata.Tags.Split(' ')); } ResultAmounts = new ResultCounts(distinctCount(artists), distinctCount(songs), distinctCount(tags)); }; api.Queue(getSetsRequest); }
private void updateSearch() { queryChangedDebounce?.Cancel(); if (!IsLoaded) { return; } BeatmapSets = null; ResultAmounts = null; getSetsRequest?.Cancel(); if (api == null) { return; } if (Header.Tabs.Current.Value == DirectTab.Search && (Filter.Search.Text == string.Empty || currentQuery == string.Empty)) { return; } getSetsRequest = new GetBeatmapSetsRequest(currentQuery.Value ?? string.Empty, ((FilterControl)Filter).Ruleset.Value, Filter.DisplayStyleControl.Dropdown.Current.Value, Filter.Tabs.Current.Value); //todo: sort direction (?) getSetsRequest.Success += r => { BeatmapSets = r?. Select(response => response.ToBeatmapSet(rulesets)). Where(b => beatmaps.QueryBeatmapSet(q => q.OnlineBeatmapSetID == b.OnlineBeatmapSetID) == null); recreatePanels(Filter.DisplayStyleControl.DisplayStyle.Value); }; api.Queue(getSetsRequest); }