I am trying to make my application play a quick .wav before closing the application, but every time it only plays the .wav and does not exit the application. Here is my code:
bool condition = false;
if (condition)
{
SoundPlayer sndPlayer = new SoundPlayer(Project_Rage_v3._1.Properties.Resources.syl);
sndPlayer.Play();
}
else
{
Application.Exit();
}
I know if the bool == true it will do the if function and if the bool == false it will do the else function. But if I don't split them up, the program just quits immediately without playing the sound.
How do I have it play the sound then quit, but only quit after the sound is finished playing?