This is a functionality so buried inside the MSDN documentation that I had to "look" at another application that uses it and only after I was able to find the documentation for it. For the moment (guess because it was not given enough visibility yet) I think there is only one store application that uses it and it is, of course, built by Microsoft (not even Nokia Music application uses it).
So what is this all about? If you develop a store application that uses the MusicLibrary capability, you can access to the audio files inside the Music library folders. The problem, until now, was that there was no way to add/remove folders to/from the Music library inside a store application so, in case the user did not had any folder added to the Music library the developers had to find a way to explain how to manually add folders to the Music library (a mess believe me).
The missing functionality is implemented by the NEW StorageLibrary class available for Windows 8.1 store applications. The class is actually a diamond in the rough:
The usage is basic but it is exactly what I needed. You need to use the GetLibraryAsync method to retrieve the StorageLibrary you need. Once you have it you can retrieve the StorageFolders currently added to the library and for the Music and Videos libraries, you can add or remove folders from this library. If removing a folder from the library the user will be prompted if he agrees with the removal. For adding a folder using the async method the user will be prompted with a folder picker and returns the newly added StorageFolder, otherwise null.
As usually I really hope that, if you need it, this blog post will spare you the hours I've spent in finding out how it is done.
Update: There is also a code sample available on msdn Library management sample
NAMASTE
0 comments:
Post a Comment