private async void ReloadAll() { var loadSartTime = DateTime.Now; ConnectionManager.ManageSystemTray(true); allArtists = await AudioLibrary.GetArtists(); var groupedAllArtists = GroupingHelper.GroupList(allArtists, (Artist a) => { return(a.Label); }, true); ArtistsCVS.Source = groupedAllArtists; allAlbums = await AudioLibrary.GetAlbums(); var groupedAllAlbums = GroupingHelper.GroupList(allAlbums, (Album a) => { return(a.Label); }, true); AlbumsCVS.Source = groupedAllAlbums; allSongs = await AudioLibrary.GetAllSongs(); var groupedAllSongs = GroupingHelper.GroupList(allSongs, (Song s) => { return(s.Label); }, true); SongsCVS.Source = groupedAllSongs; ConnectionManager.ManageSystemTray(false); GlobalVariables.CurrentTracker.SendTiming((DateTime.Now.Subtract(loadSartTime)), TimingCategories.LoadTime, "AllMusic", "AllMusic"); }
private async void ReloadAll() { ConnectionManager.ManageSystemTray(true); allArtists = await AudioLibrary.GetArtists(); var groupedAllArtists = GroupingHelper.GroupList(allArtists, (Artist a) => a.Label, true); ArtistsCVS.Source = groupedAllArtists; (ArtistsSemanticZoom.ZoomedOutView as ListViewBase).ItemsSource = ArtistsCVS.View.CollectionGroups; Sort sort = new Sort { Method = "label", Order = "ascending", IgnoreArticle = true }; allAlbums = await AudioLibrary.GetAlbums(sort : sort); var groupedAllAlbums = GroupingHelper.GroupList(allAlbums, (Album a) => a.Label, true); AlbumsCVS.Source = groupedAllAlbums; (AlbumsSemanticZoom.ZoomedOutView as ListViewBase).ItemsSource = AlbumsCVS.View.CollectionGroups; allSongs = await AudioLibrary.GetSongs(sort : sort); var groupedAllSongs = GroupingHelper.GroupList(allSongs, (Song s) => s.Label, true); SongsCVS.Source = groupedAllSongs; (SongsSemanticZoom.ZoomedOutView as ListViewBase).ItemsSource = SongsCVS.View.CollectionGroups; ConnectionManager.ManageSystemTray(false); }
private async void SearchAndReload(string query) { ConnectionManager.ManageSystemTray(true); Filter artistFilter = new Filter { Field = "artist", Operator = "contains", value = query }; Sort artistSort = new Sort { Method = "artist", Order = "ascending", IgnoreArticle = true }; ArtistSearchListView.ItemsSource = await AudioLibrary.GetArtists(artistFilter, sort : artistSort); Filter albumFilter = new Filter { Field = "album", Operator = "contains", value = query }; Sort albumSort = new Sort { Method = "album", Order = "ascending", IgnoreArticle = true }; AlbumSearchGridView.ItemsSource = await AudioLibrary.GetAlbums(albumFilter, sort : albumSort); Filter songFilter = new Filter { Field = "title", Operator = "contains", value = query }; Sort songSort = new Sort { Method = "title", Order = "ascending", IgnoreArticle = true }; SongsSearchListView.ItemsSource = await AudioLibrary.GetSongs(songFilter, sort : songSort); ConnectionManager.ManageSystemTray(false); }
private async void ReloadAll() { ConnectionManager.ManageSystemTray(true); allArtists = await AudioLibrary.GetArtists(); var groupedAllArtists = GroupingHelper.GroupList(allArtists, (Artist a) => { return(a.Label); }, true); AllArtistsLLS.ItemsSource = groupedAllArtists; JObject sortWith = new JObject(new JProperty("method", "label")); allAlbums = await AudioLibrary.GetAlbums(sort : sortWith); var groupedAllAlbums = GroupingHelper.GroupList(allAlbums, (Album a) => { return(a.Label); }, true); AllAlbumsLLS.ItemsSource = groupedAllAlbums; allSongs = await AudioLibrary.GetSongs(sort : sortWith); var groupedAllSongs = GroupingHelper.GroupList(allSongs, (Song s) => { return(s.Label); }, true); AllSongsLLS.ItemsSource = groupedAllSongs; ConnectionManager.ManageSystemTray(false); }
private async void ExecuteVoiceCommand(SpeechRecognitionResult result) { bool isConnected = await LoadAndConnnect(); if (!isConnected) { return; } string voiceCommandName = result.RulePath[0]; string textSpoken = result.Text; switch (voiceCommandName) { case "PlayArtist": searchType = SearchType.Artist; string artistName = SemanticInterpretation("musicTopic", result); allArtists = await AudioLibrary.GetArtists(); var filteredArtists = allArtists.Where(t => t.Label.ToLower().Contains(artistName.ToLower())).ToList(); if (filteredArtists.Count > 1) { searchHitState = SearchHitState.Multiple; ReceivedCommandTextBlock.Text = "We found multiple artists. Choose one..."; SearchedItemsListView.ItemsSource = filteredArtists; } else if (filteredArtists.Count > 0) { searchHitState = SearchHitState.Single; ReceivedCommandTextBlock.Text = "This is the artist we found..."; SearchedItemsListView.ItemsSource = filteredArtists; Player.PlayArtist(filteredArtists[0]); QuestionNameTextBlock.Text = "Did we get the right one?"; QuestionWrapper.Visibility = Windows.UI.Xaml.Visibility.Visible; } else { searchHitState = SearchHitState.None; ReceivedCommandTextBlock.Text = "Sorry, we couldn't find what you asked for."; //SearchedItemsListView.ItemsSource = allArtists; QuestionNameTextBlock.Text = "Would you like to see a list of all artists?"; QuestionWrapper.Visibility = Windows.UI.Xaml.Visibility.Visible; } break; case "PlayMovie": searchType = SearchType.Movie; string movieName = SemanticInterpretation("movieTopic", result); allMovies = await VideoLibrary.GetMovies(); var filteredMovies = allMovies.Where(t => t.Title.ToLower().Contains(movieName.ToLower())).ToList(); if (filteredMovies.Count > 1) { searchHitState = SearchHitState.Multiple; ReceivedCommandTextBlock.Text = "We found multiple movies. Choose one..."; SearchedItemsListView.ItemsSource = filteredMovies; } else if (filteredMovies.Count > 0) { searchHitState = SearchHitState.Single; ReceivedCommandTextBlock.Text = "This is the movie we found..."; SearchedItemsListView.ItemsSource = filteredMovies; Player.PlayMovie(filteredMovies[0]); QuestionNameTextBlock.Text = "Did we find the right one?"; QuestionWrapper.Visibility = Windows.UI.Xaml.Visibility.Visible; } else { searchHitState = SearchHitState.None; ReceivedCommandTextBlock.Text = "Sorry, we couldn't find what you asked for. Here is the list of all movies."; //SearchedItemsListView.ItemsSource = allMovies; QuestionNameTextBlock.Text = "Would you like to see a list of all movies?"; QuestionWrapper.Visibility = Windows.UI.Xaml.Visibility.Visible; } break; case "PlayAlbum": searchType = SearchType.Album; string albumName = SemanticInterpretation("musicTopic", result); allAlbums = await AudioLibrary.GetAlbums(); var filteredAlbums = allAlbums.Where(t => t.Title.ToLower().Contains(albumName.ToLower())).ToList(); if (filteredAlbums.Count > 1) { searchHitState = SearchHitState.Multiple; ReceivedCommandTextBlock.Text = "We found multiple albums. Choose one..."; SearchedItemsListView.ItemsSource = filteredAlbums; } else if (filteredAlbums.Count > 0) { searchHitState = SearchHitState.Single; ReceivedCommandTextBlock.Text = "This is the album we found..."; SearchedItemsListView.ItemsSource = filteredAlbums; Player.PlayAlbum(filteredAlbums[0]); QuestionNameTextBlock.Text = "Did we get the right one?"; QuestionWrapper.Visibility = Windows.UI.Xaml.Visibility.Visible; } else { searchHitState = SearchHitState.None; ReceivedCommandTextBlock.Text = "Sorry, we couldn't find what you asked for. Here is the list of all albums."; //SearchedItemsListView.ItemsSource = allAlbums; QuestionNameTextBlock.Text = "Would you like to see a list of all albums?"; QuestionWrapper.Visibility = Windows.UI.Xaml.Visibility.Visible; } break; case "StartParty": await Player.PlayPartyMode(); ReceivedCommandTextBlock.Text = "Started party mode!"; await Task.Delay(1000); Frame.Navigate(typeof(CoverPage)); break; default: break; } if (searchHitState == SearchHitState.Single) { GlobalVariables.CurrentTracker.SendEvent(EventCategories.VoiceCommand, EventActions.VoiceCommand, "Single" + voiceCommandName, 0); } else if (searchHitState == SearchHitState.None) { GlobalVariables.CurrentTracker.SendEvent(EventCategories.VoiceCommand, EventActions.VoiceCommand, "Zero" + voiceCommandName, 0); } }