Windows phone 8 我可以在AudioPlayer类中添加数据库查询吗?wp8

Windows phone 8 我可以在AudioPlayer类中添加数据库查询吗?wp8,windows-phone-8,Windows Phone 8,我想用数据库表中保存的曲目填充我的后台播放器播放列表。 如何在我的windows phone 8应用程序中做到这一点?BackgroundAudioPlayer只能播放来自独立存储或远程URI的文件。您所需要做的就是将音频曲目列表作为播放器的播放列表 这些只是根据您的需要修改的示例 //使用文件的IsolatedStorageFileStream Name属性获取跟踪的uri。 私有静态字符串GetAbsolutePath(字符串文件名) { IsolatedStorageFile isoSt

我想用数据库表中保存的曲目填充我的后台播放器播放列表。
如何在我的windows phone 8应用程序中做到这一点?

BackgroundAudioPlayer只能播放来自独立存储或远程URI的文件。您所需要做的就是将音频曲目列表作为播放器的播放列表

这些只是根据您的需要修改的示例

//使用文件的IsolatedStorageFileStream Name属性获取跟踪的uri。

私有静态字符串GetAbsolutePath(字符串文件名)
{
IsolatedStorageFile isoStore=IsolatedStorageFile.GetUserStoreForApplication();
字符串AbsolutePath=null;
if(isoStore.FileExists(filename))
{
IsolatedStorageFileStream输出=新的IsolatedStorageFileStream(文件名,FileMode.Open,isoStore);
AbsolutePath=output.Name;
output.Close();
输出=空;
}
返回绝对路径;
}
//现在用要跟踪的uri实例化音频曲目列表
名单

 private static string GetAbsolutePath(string filename)
    {
        IsolatedStorageFile isoStore = IsolatedStorageFile.GetUserStoreForApplication();

        string absoulutePath = null;

        if (isoStore.FileExists(filename))
        {
            IsolatedStorageFileStream output = new IsolatedStorageFileStream(filename, FileMode.Open, isoStore);
            absoulutePath = output.Name;

            output.Close();
            output = null;
        }

        return absoulutePath;
    }

    //now instantiate list of audio track with the uri to track
    List<AudioTrack>  = new List<AudioTrack>
    {
        new AudioTrack(new Uri("URI TO FILE IN ISOLATED STORAGE", UriKind.Relative), 
                "title",
                "artist",
                "album",
                "Uri To albumArt or null"),

        new AudioTrack(new Uri("URI TO FILE IN ISOLATED STORAGE", UriKind.Relative), 
                "title",
                "artist",
                "album",
                "Uri To albumArt or null")
    };