Visual Studio Windows Phone 7播放声音

Chr*_*ris 3 c# visual-studio-2010 windows-phone-7

我正在创建一个Windows Phone 7应用程序,我正试图播放声音.

我有代码来做它但是当我尝试在模拟器上运行它时它无法找到该文件.

我已将声音文件添加为资源(我认为)

这是代码,以防它出现问题

PlaySound(@"Sounds\show.wav");
Run Code Online (Sandbox Code Playgroud)

而且功能

private void PlaySound(string path)
    {
        try
        {
            if (!string.IsNullOrEmpty(path))
            {
                using (var stream = TitleContainer.OpenStream(path))
                {
                    if (stream != null)
                    {
                        var effect = SoundEffect.FromStream(stream);
                        FrameworkDispatcher.Update();
                        effect.Play();
                    }
                }
            }
        }catch(Exception e){
            timerCount.Text = path;
        }
    }
Run Code Online (Sandbox Code Playgroud)

Mat*_*cey 6

Build Action文件设置为Content.