private void handleSearch() { if (Name.hasErrors()) { return; } var terms = new SearchTerms(Name.Value, null, null, 0, new string[] { }); Result <SongModel> res = Utility.attemptSearch(terms); Searched?.Invoke(this, res); }
public static Result <SongModel> attemptSearch(SearchTerms terms) { if (terms == null) { return(new Result <SongModel>()); } if (terms.Name == null && terms.Artist == null && terms.Album == null && terms.Author == null && terms.Rating == 0 && terms.Tags.Length == 0) { return(APIRequest.getAllSongs().GetAwaiter().GetResult()); } SongSearchRequest search = new SongSearchRequest(terms.Name, terms.Artist, terms.Album, terms.Author, terms.Rating, terms.Tags); return(APIRequest.searchSongs(search).GetAwaiter().GetResult()); }
public void handleSearch() { SearchTerms terms = Search.getSearchTerms(); Result <SongModel> res = Utility.attemptSearch(terms); if (res.Error != null) { Error.Value = res.Error.Message; } else { Error.Value = String.Empty; Results.populateModels(res.Items); } }