Exemplo n.º 1
0
        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());
        }
Exemplo n.º 2
0
        public void handleSearch()
        {
            SearchTerms        terms = Search.getSearchTerms();
            Result <SongModel> res   = Utility.attemptSearch(terms);

            if (res.Error != null)
            {
                Error = res.Error.Message;
            }
            else
            {
                Error = String.Empty;
                Results.populateModels(res.Items);
            }
        }