3
我正在創建Windows Phone 7應用程序,並試圖播放聲音。Visual Studio Windows Phone 7播放聲音
我有代碼來做到這一點,但當我試圖在模擬器上運行它時找不到文件。
我已經添加了聲音文件作爲資源(我認爲)
這裏是在情況下,它的問題是
PlaySound(@"Sounds\show.wav");
而且功能
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;
}
}
克里斯? – Seva 2010-11-27 21:10:24