public async Task SearchFolders(FolderTree source, string keyword, SortBy criterion) { AllFolders.SetTo(await Task.Run(() => SearchHelper.SearchFolders(source, keyword, criterion))); Folders.SetTo(AllFolders.Take(FolderLimit)); FoldersTextBlock.Text = Settings.settings.ShowCount ? Helper.LocalizeText("FoldersWithCount", AllFolders.Count) : Helper.LocalizeText("Folders"); FoldersViewAllButton.Visibility = AllFolders.Count > FolderLimit ? Visibility.Visible : Visibility.Collapsed; SortFoldersButton.Visibility = AllFolders.Count < 2 ? Visibility.Collapsed : Visibility.Visible; }
private void SortFoldersButton_Click(object sender, RoutedEventArgs e) { MenuFlyoutHelper.SetSortByMenu(sender, Settings.settings.SearchFoldersCriterion, FoldersCriteria, async item => { Settings.settings.SearchFoldersCriterion = item; LoadingProgress.Visibility = Visibility.Visible; AllFolders.SetTo(await Task.Run(() => SearchHelper.SortFolders(AllFolders, CurrentKeyword.Text, item).ToList())); Folders.SetTo(AllFolders.Take(Folders.Count)); LoadingProgress.Visibility = Visibility.Collapsed; }); }