Example #1
0
 public async Task SearchSongs(IEnumerable <Music> source, string keyword, SortBy criterion)
 {
     AllSongs.SetTo(await Task.Run(() => SearchHelper.SearchSongs(source, keyword, criterion)));
     Songs.SetTo(AllSongs.Take(SongLimit));
     SongsTextBlock.Text           = Settings.settings.ShowCount ? Helper.LocalizeText("SongsWithCount", AllSongs.Count) : Helper.LocalizeText("Songs");
     SongsViewAllButton.Visibility = AllSongs.Count > SongLimit ? Visibility.Visible : Visibility.Collapsed;
     SortSongsButton.Visibility    = Songs.Count < 2 ? Visibility.Collapsed : Visibility.Visible;
 }
Example #2
0
 private void SortSongsButton_Click(object sender, RoutedEventArgs e)
 {
     MenuFlyoutHelper.SetSortByMenu(sender, Settings.settings.SearchSongsCriterion, SongsCriteria,
                                    async item =>
     {
         Settings.settings.SearchSongsCriterion = item;
         LoadingProgress.Visibility             = Visibility.Visible;
         AllSongs.SetTo(await Task.Run(() => SearchHelper.SortSongs(AllSongs, CurrentKeyword.Text, item).ToList()));
         Songs.SetTo(AllSongs.Take(Songs.Count));
         LoadingProgress.Visibility = Visibility.Collapsed;
     });
 }