private async void DeleteAppBarButton_Click(object sender, RoutedEventArgs e) { LoadingRing.Visibility = Visibility.Visible; GridView collectionGridView = VisualTreeHelperExtensions.GetFirstDescendantOfType <GridView>(CollectionsHubSection); foreach (CollectionView collectionView in collectionGridView.SelectedItems) { CollectionTile collectionTile = collectionView.Tile; CollectionTiles.Remove(collectionTile); CollectionViews.Remove(collectionView); StorageFolder localFolder = Windows.Storage.ApplicationData.Current.LocalFolder; StorageFolder collectionsFolder = (StorageFolder)await localFolder.TryGetItemAsync("Collections"); if (null != collectionsFolder) { StorageFolder collectionFolder = await collectionsFolder.TryGetItemAsync(collectionTile.Title) as StorageFolder; await collectionFolder.DeleteAsync(); } } GridView recentlyOpenedGridView = VisualTreeHelperExtensions.GetFirstDescendantOfType <GridView>(RecentlyOpenedHubSection); foreach (ComicTile comicTile in recentlyOpenedGridView.SelectedItems) { ComicTiles.Remove(comicTile); await comicTile.Folder.DeleteAsync(); } LoadingRing.Visibility = Visibility.Collapsed; }
private async Task CreateComicTiles() { StorageFolder localFolder = Windows.Storage.ApplicationData.Current.LocalFolder; StorageFolder recentlyOpened = (StorageFolder)await localFolder.TryGetItemAsync("Recently Opened"); if (recentlyOpened == null) { await localFolder.CreateFolderAsync("Recently Opened"); recentlyOpened = await localFolder.GetFolderAsync("Recently Opened"); } IReadOnlyList <StorageFolder> list = await recentlyOpened.GetFoldersAsync(); for (int i = 0; i < list.Count; i++) { IReadOnlyList <StorageFile> list2 = await list[i].GetFilesAsync(); if (list2.Count > 0) { String imagePath = list2[0].Path; ComicTiles.Add(new ComicTile(list[i].Name, imagePath, list[i])); } } }