コード例 #1
0
        private void OnRunSearch()
        {
            var filter    = new SearchFilter(SearchText);
            var navparams = NavigationHelper.CreateSearchFilterNavigation(filter);

            _regionManager.RequestNavigate(Regions.ContentRegion, ViewNames.SearchedSongsView, navparams);
        }
コード例 #2
0
 /// <summary>
 /// This is for the single searches on each filter box
 /// </summary>
 /// <param name="filter"></param>
 private void OnRunSearch(DjHorsifyFilterModel filter)
 {
     if (filter != null)
     {
         Log("Running single search view DJHorsify", Category.Debug);
         var navParams = NavigationHelper.CreateSearchFilterNavigation(filter);
         _regionManager.RequestNavigate(Regions.ContentRegion, "SearchedSongsView", navParams);
     }
 }
コード例 #3
0
        private void OnRunSearch()
        {
            Log("Running A-Z search: ", Category.Debug);
            _searchFilter         = new SearchFilter();
            _searchFilter.Filters = new List <HorsifyFilter>(SelectedFilters);

            Log($"Selected Filters count: {SelectedFilters.Count}", Category.Debug);

            var navParams = NavigationHelper.CreateSearchFilterNavigation(_searchFilter);

            Log($"Navigating search view: ", Category.Debug);
            _regionManager.RequestNavigate(Regions.ContentRegion, ViewNames.SearchedSongsView, navParams);

            SearchResults.Clear();
            this.SelectedCharachter = null;
        }
コード例 #4
0
        private void OnSearchSongs(string str)
        {
            if (!string.IsNullOrEmpty(str))
            {
                if (SelectedSong != null)
                {
                    try
                    {
                        Log("Creating search...");
                        SearchType searchType = (SearchType)Enum.Parse(typeof(SearchType), str);
                        string     searchTerm = SelectedSong.GetType().GetProperty(str).GetValue(SelectedSong).ToString();

                        NavigationParameters navParams = NavigationHelper.CreateSearchFilterNavigation(searchType, searchTerm);
                        _regionManager.RequestNavigate(Regions.ContentRegion, ViewNames.SearchedSongsView, navParams);
                    }
                    catch (Exception ex)
                    {
                        Log(ex.Message, Category.Exception);
                        throw;
                    }
                }
            }
        }
コード例 #5
0
        private void OnRunSearchCommand(string searchType)
        {
            NavigationParameters navParams = NavigationHelper.CreateSearchFilterNavigation(MediaControlModel.SelectedSong, searchType);

            _regionManager.RequestNavigate(Regions.ContentRegion, ViewNames.SearchedSongsView, navParams);
        }
コード例 #6
0
        private void _voiceControl_VoiceCommandSent(string voicetext)
        {
            Log(voicetext);

            if (voicetext == "horsify search")
            {
                HorsifyVoiceActive = true;
                Log($"{voicetext} - activated");
                VoiceHelper = "Horsify Search";
            }
            else if (voicetext == "horsify play")
            {
                HorsifyVoiceActive = true;
                Log($"{voicetext} - activated");
                VoiceHelper = "What's the Song Id?";
            }
            else if (voicetext == "horsify queue")
            {
                HorsifyVoiceActive = true;
                Log($"{voicetext} - activated");
                VoiceHelper = "Queue Song Id...";
            }
            else
            {
                if (_voiceControl.Command == VoiceCommand.Search)
                {
                    _regionManager.RequestNavigate(Regions.ContentRegion, ViewNames.SearchedSongsView, NavigationHelper.CreateSearchFilterNavigation(
                                                       new SearchFilter($"%{voicetext}%")));

                    HorsifyVoiceActive = false;
                }
                else if (_voiceControl.Command == VoiceCommand.Play)
                {
                    var songId = 0;
                    int.TryParse(voicetext, out songId);

                    if (songId > 0)
                    {
                        var songToPlay = this.SearchedSongs
                                         .FirstOrDefault((x) => x.Id == songId);

                        if (songToPlay != null)
                        {
                            Log($"Playing song {voicetext}");
                            _eventAggregator
                            .GetEvent <OnMediaPlay <AllJoinedTable> >().Publish(songToPlay);
                        }
                        else
                        {
                            Log($"Couldn't find song to play: {voicetext}");
                        }
                    }

                    HorsifyVoiceActive = false;
                }
                else if (_voiceControl.Command == VoiceCommand.Queue)
                {
                    var songId = 0;
                    int.TryParse(voicetext, out songId);

                    if (songId > 0)
                    {
                        var songToPlay = this.SearchedSongs
                                         .FirstOrDefault((x) => x.Id == songId);

                        if (songToPlay != null)
                        {
                            Log($"Queueing song {voicetext}");
                            _queuedSongDataProvider.Add(songToPlay);
                        }
                        else
                        {
                            Log($"Couldn't find song to queue: {voicetext}");
                        }
                    }

                    HorsifyVoiceActive = false;
                }
            }
        }
コード例 #7
0
        /// <summary>
        /// Select a menu button
        /// </summary>
        /// <returns></returns>
        private void SelectMenu(SearchButtonViewModel searchButtonViewModel)
        {
            if (IsBusy)
            {
                Log($"Searching busy..."); return;
            }

            var menuComponent = searchButtonViewModel.MenuComponent;

            if (menuComponent.GetType() == typeof(Menu))
            {
                Log("Menu Selected", Category.Debug);

                //Check if has children and return if has children
                if (menuComponent.GetChild(0) != null)
                {
                    this.UpdateSearchButtons(menuComponent);
                    return;
                }
            }

            //Treat as MenuItem
            var menuName = menuComponent?.Name;

            //Return back if menu is Back or IsBusy
            if (menuName == "Back")
            {
                if (menuComponent.Parent.Name == "Root")
                {
                    this.UpdateSearchButtons(this.mCreator._rootMenu);
                }
                else
                {
                    this.UpdateSearchButtons(menuComponent.Parent);
                }
                return;
            }


            NavigationParameters navParams = null;
            string viewName = string.Empty;

            if (menuComponent?.ExtraSearchType != ExtraSearchType.None)
            {
                IsBusy = true;
                Log($"Navigating SearchedSongs with extra search type");
                navParams = new NavigationParameters();
                navParams.Add("extra_search", menuComponent.ExtraSearchType);
                viewName = ViewNames.SearchedSongsView;
            }
            else if (menuComponent?.SearchString == "SEARCH")
            {
                switch (menuName)
                {
                case "A-Z":
                    viewName = ViewNames.AToZSearchView;
                    break;

                case "SEARCH":
                    viewName = ViewNames.SearchView;
                    break;

                case "SONG SEARCH":
                    viewName = ViewNames.InstantSearch;
                    break;

                default:
                    break;
                }
            }
            else if (menuName == "DJ Horsify" || menuName == "Filter" || menuName == "Database Stats")
            {
                if (menuName == "DJ Horsify")
                {
                    viewName = ViewNames.DjHorsifyView;
                }
                else if (menuName == "Filter")
                {
                    viewName = ViewNames.FilterCreatorView;
                }
            }
            else
            {
                navParams = NavigationHelper
                            .CreateSearchFilterNavigation(menuComponent.SearchType,
                                                          menuComponent.SearchString != null ? menuComponent.SearchString : menuComponent.Name);

                viewName = ViewNames.SearchedSongsView;
            }

            Log($"Navigating{viewName}");
            if (navParams != null)
            {
                Log($"View params available, setting sidebar busy.");
                IsBusy = true;
            }

            //Request nav on the main thread
            Application.Current.Dispatcher.Invoke(() =>
            {
                _regionManager.RequestNavigate(Regions.ContentRegion, viewName, navParams);
            });
        }