I'm playing a game with some others coders. You get to write one oneline of C# and as many xaml lines as you want.
Anyone know how to play a sound in one line before the semi-colon;
This is as close as I can get so far
SoundPlayer simpleSound = new SoundPlayer(@"c:\Media\pacman.wav");
simpleSound.Play();
Edit: tried Blorgbeard's code, but sound isn't playing for some reason
if (Listbox.SelectedItem.ToString() == "2 Good 2 B True")
{
try
{
(new SoundPlayer(@"/Project;component/sounds/pacman.wav")).Play();
}
catch (Exception ex)
{
Console.Error.WriteLine(ex.Message);
}
}