简体   繁体   English

从Playback Audio Agent WP8 c#打开本地数据库

[英]Open local database from Playback Audio Agent WP8 c#

I want to create the background audio _playlist from a local database table (LINQ). 我想从本地数据库表(LINQ)创建背景音频_playlist。 Here's the code in AudioPlayer.cs in the PlaybackAudio project: 这是PlaybackAudio项目中AudioPlayer.cs中的代码:

  private static List<AudioTrack> _playList = new List<AudioTrack> { new AudioTrack( new Uri("Ring01.mp3", UriKind.Relative), "Some song", // can be an empty string if no song title "Some artist", // can be an empty string if no artist name null, // album null // album art ) }; 

and i want to tansform it in: 我想将其变形:

  private static List<AudioTrack> _playList = from SongsItem song in songsDB.Items select new AudioTrack( new Uri(SongsItem.url, UriKind.Relative), "SongsItem.title", // can be an empty string if no song title "SongsItem.artist", // can be an empty string if no artist name null, // album null // album art ); 

For that I need to connect the playback audio to a local database. 为此,我需要将播放音频连接到本地数据库。 If it isn't possible, can I create the playlist from the main project? 如果不可能,我可以从主项目中创建播放列表吗?

I don't know a LINQ solution for your problem. 我不知道您的问题的LINQ解决方案。 However you can definitely create the playlist from your main project. 但是,您绝对可以从您的主项目中创建播放列表。 The main concept is that you will need to save your songs in a file (.dat for example) in Isolated Storage. 主要概念是您需要将歌曲保存在独立存储中的文件(例如,.dat)中。 Then you will retreive the music of your playlist from Isolated Storage. 然后,您将从隔离存储中检索播放列表中的音乐。 To this direction the following sample from Nokia website will help you. 为此,诺基亚网站上的以下示例将为您提供帮助。 Have a look : 看一看 :

Saving and Retreiving from Isolated Storage Example 从隔离存储示例保存和检索

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM