예제 #1
0
        /// <summary>
        /// Runs a search with all the DJ Horsify Options
        /// </summary>
        private void OnRunSearch()
        {
            Log("Running search view DJHorsify", Category.Debug);
            if (!this.DjHorsifyOption.IsOptionsValid())
            {
                Log("The DJ Horsify Options are not enabled or incorrect to run searches", Category.Warn);
                return;
            }

            try
            {
                //Reset the selected keys if not enabled and have any selected.
                if (!this.DjHorsifyOption.HarmonicEnabled)
                {
                    this.DjHorsifyOption.SelectedKeys = Music.Data.Model.Import.OpenKeyNotation.None;
                }

                var searchFilter = _djHorsifyService.GenerateSearchFilter(this.DjHorsifyOption);
                if (searchFilter == null)
                {
                    throw new NullReferenceException("Generating search filter from Dj Horsify option failed.");
                }

                var navParams = new NavigationParameters();
                navParams.Add("djhorsify_search", searchFilter);
                _regionManager.RequestNavigate(Regions.ContentRegion, ViewNames.SearchedSongsView, navParams);
            }
            catch (Exception ex)
            {
                Log($"Fail to run search from DJ Horsify : {ex.Message}", Category.Exception);
                throw;
            }
        }
예제 #2
0
        private FiltersSearch CreateFilterSearch()
        {
            var searchFilter = _djHorsifyService.GenerateSearchFilter(_djHorsifyService.DjHorsifyOption);

            var content   = Newtonsoft.Json.JsonConvert.SerializeObject(searchFilter);
            var newFilter = new FiltersSearch()
            {
                MaxAmount           = -1,
                RandomAmount        = _djHorsifyService.DjHorsifyOption.Amount,
                Name                = SearchFilterName,
                SearchFilterContent = content
            };

            return(newFilter);
        }