Exemplo n.º 1
0
        async void ImportPlaylists()
        {
            var            picker     = new FileOpenPicker();
            FileOpenPicker openPicker = new FileOpenPicker();

            openPicker.ViewMode = PickerViewMode.Thumbnail;
            openPicker.SuggestedStartLocation = PickerLocationId.MusicLibrary;
            openPicker.FileTypeFilter.Add(".m3u");
            openPicker.FileTypeFilter.Add(".pls");
            StorageFile file = await openPicker.PickSingleFileAsync();

            IPlaylist playlist = null;

            if (Path.GetExtension(file.Path) == ".m3u")
            {
                playlist = new M3U();
            }
            else
            {
                playlist = new PLS();
            }
            var dict = await playlist.LoadPlaylist(file);

            LibVM.AddPlaylist(dict, file.DisplayName, "");
        }
 async void ImportPlaylists()
 {
     var picker = new FileOpenPicker();
     FileOpenPicker openPicker = new FileOpenPicker();
     openPicker.ViewMode = PickerViewMode.Thumbnail;
     openPicker.SuggestedStartLocation = PickerLocationId.MusicLibrary;
     openPicker.FileTypeFilter.Add(".m3u");
     openPicker.FileTypeFilter.Add(".pls");
     StorageFile file = await openPicker.PickSingleFileAsync();          
     if(file != null)
     {
         var plist = new Playlist() { Name = file.DisplayName };
         LibVM.AddPlaylist(plist);
         LibVM.Database.playlists.Insert(plist);
         IPlaylist playlist = null;
         if (Path.GetExtension(file.Path) == ".m3u") playlist = new M3U();
         else playlist = new PLS();
         await playlist.LoadPlaylist(file).ConfigureAwait(false);
     }
 }