我有一个非常简单的函数close(); 的退出按钮;.
我怎样才能做到这一点?声音结束(2-3 秒)应用程序关闭后。
private void button1_Click(object sender, EventArgs e)
{
// Play sound
this.playSound();
// WAIT FOR END OF SOUND
Close();
}
private void playSound()
{
Random random = new Random();
// Create list of quit music
List<System.IO.UnmanagedMemoryStream> sound = new List<System.IO.UnmanagedMemoryStream>
{
global::Launcher.Properties.Resources.sound_quit_1,
global::Launcher.Properties.Resources.sound_quit_2,
global::Launcher.Properties.Resources.sound_quit_3,
global::Launcher.Properties.Resources.sound_quit_4,
};
// Random, set and play sound
(new SoundPlayer(sound[random.Next(sound.Count)])).Play();
}