コード例 #1
0
        public async Task SearchLikeFiltersAsync(SearchFilter searchFilter, short randomAmount = 0, short maxAmount = -1)
        {
            ResetResults();

            var results = await _horsifySongApi.SearchLikeFiltersAsync(searchFilter, randomAmount, maxAmount);

            if (results?.Count() > 0)
            {
                SearchedSongs.AddRange(results);
            }
        }
コード例 #2
0
        private void RunSearch()
        {
            var arr = new string[] { "*" + SearchModel.SearchText + "*" };
            IEnumerable <AllJoinedTable> results = null;

            IsBusy = true;
            Task.Run(async() =>
            {
                results = await _horsifySongApi.SearchLikeFiltersAsync(new SearchFilter(arr, SearchModel.SelectedSearchType), maxAmount: 100);
            }).ContinueWith((t) =>
            {
                Application.Current.Dispatcher.Invoke(() =>
                {
                    if (results == null)
                    {
                        SearchModel.AllJoinedTables.Clear();
                    }
                    else
                    {
                        IsBusy    = false;
                        var sType = SearchModel.SelectedSearchType;
                        if (sType == SearchType.Album)
                        {
                            SearchModel.AllJoinedTables.AddRange(results.OrderBy(x => x.Artist).ThenBy(x => x.Album));
                        }
                        else if (sType == SearchType.Artist)
                        {
                            SearchModel.AllJoinedTables.AddRange(results.OrderBy(x => x.Artist));
                        }
                        else
                        {
                            SearchModel.AllJoinedTables.AddRange(results.OrderBy(x => x.Title));
                        }
                    }
                });
            });
        }
コード例 #3
0
        /// <summary>
        /// Gets the songs using the DjHorsifyOption
        /// </summary>
        /// <returns></returns>
        public IEnumerable <AllJoinedTable> GetSongs(IDjHorsifyOption djHorsifyOption)
        {
            var searchFilter = GenerateSearchFilter(djHorsifyOption);

            return(_horsifySongApi.SearchLikeFiltersAsync(searchFilter, (short)djHorsifyOption.Amount, (short)djHorsifyOption.Amount).Result);
        }