title: Visual Studio Windows Phone 7 play sound
body: <p>I'm creating a Windows Phone 7 App and am trying to play a sound.</p>
  
  <p>I have the code to do it but it cannot find the file when I try to run it on the emulator.</p>
  
  <p>I have added the sound file as a resource (I think)</p>
  
  <p>here is the code in case it is the problem</p>
  
  <pre><code>PlaySound(@"Sounds\show.wav");
  </code></pre>
  
  <p>And the function</p>
  
  <pre><code>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;
          }
      }
  </code></pre>