Advertisement
Guest User

Untitled

a guest
Apr 18th, 2014
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.85 KB | None | 0 0
  1. A first chance exception of type
  2. 'System.UnauthorizedAccessException'
  3. occurred in AccessingPictures.exe
  4.  
  5. public async void getFile()
  6. {
  7. StorageFolder folder = KnownFolders.MusicLibrary;
  8.  
  9. try
  10. {
  11. sampleFile = await folder.GetFileAsync("Test1.mp3");
  12. }
  13. catch (FileNotFoundException e)
  14. {
  15. // If file doesn't exist, indicate users to use scenario 1
  16. Debug.WriteLine(e);
  17. }
  18. }
  19.  
  20. private void btnRead_Click(object sender, RoutedEventArgs e)
  21. {
  22. getFile();
  23. }
  24.  
  25. Void GetCameraPhotos()
  26. {
  27. using (var library = new MediaLibrary())
  28. {
  29.  
  30. PictureAlbumCollection allAlbums = library.RootPictureAlbum.Albums;
  31. PictureAlbum cameraRoll = allAlbums.Where(album => album.Name == "Camera Roll").FirstOrDefault();
  32. var CameraRollPictures = cameraRoll.Pictures
  33.  
  34. }
  35. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement