Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- private async void button_Click(object sender, RoutedEventArgs e)
- {
- StorageFolder picturesFolder = await KnownFolders.GetFolderForUserAsync(null /* current user */, KnownFolderId.MusicLibrary);
- IReadOnlyList<StorageFile> fileList = await picturesFolder.GetFilesAsync();
- IReadOnlyList<StorageFolder> folderList = await picturesFolder.GetFoldersAsync();
- var count = fileList.Count + folderList.Count;
- StringBuilder outputText = new StringBuilder(picturesFolder.Name + " (" + count + ")\n\n");
- foreach (StorageFolder folder in folderList)
- {
- Button submitButton = new Button();
- submitButton.Content = folder.DisplayName;
- submitButton.Click += SubmitButton_Click;
- OutputPanel.Children.Add(submitButton);
- }
- foreach (StorageFile file in fileList)
- {
- outputText.AppendLine(file.Name);
- }
- OutputTextBlock.Text = outputText.ToString();
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement