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

时间:2014-05-18 11:31:31

标签: c# linq windows-phone-8 local-database background-audio

我想从本地数据库表(LINQ)创建背景音频_playlist。 这是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
            )
    };

我希望将其改为:

    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
            );

为此,我需要将播放音频连接到本地数据库。 如果不可能,我可以从主项目创建播放列表吗?

1 个答案:

答案 0 :(得分:0)

我不知道您的问题的LINQ解决方案。但是,您绝对可以从主项目中创建播放列表。主要概念是您需要将歌曲保存在隔离存储中的文件(例如.dat)中。然后,您将从隔离存储中检索播放列表的音乐。为此,诺基亚网站上的以下示例将为您提供帮助。看看:

Saving and Retreiving from Isolated Storage Example

相关问题