Advertisement
Guest User

MusicPicker

a guest
Aug 15th, 2016
181
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.07 KB | None | 0 0
  1. private async void button_Click(object sender, RoutedEventArgs e)
  2.         {
  3.             StorageFolder picturesFolder = await KnownFolders.GetFolderForUserAsync(null /* current user */, KnownFolderId.MusicLibrary);
  4.  
  5.             IReadOnlyList<StorageFile> fileList = await picturesFolder.GetFilesAsync();
  6.             IReadOnlyList<StorageFolder> folderList = await picturesFolder.GetFoldersAsync();
  7.  
  8.             var count = fileList.Count + folderList.Count;
  9.  
  10.             StringBuilder outputText = new StringBuilder(picturesFolder.Name + " (" + count + ")\n\n");
  11.  
  12.             foreach (StorageFolder folder in folderList)
  13.             {
  14.                 Button submitButton = new Button();
  15.                 submitButton.Content = folder.DisplayName;
  16.                 submitButton.Click += SubmitButton_Click;
  17.                 OutputPanel.Children.Add(submitButton);
  18.             }
  19.  
  20.             foreach (StorageFile file in fileList)
  21.             {
  22.                 outputText.AppendLine(file.Name);
  23.             }
  24.  
  25.             OutputTextBlock.Text = outputText.ToString();
  26.  
  27.         }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement