本当に単純な関数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();
}