how are you?
I need to use two commands in my application, however, need to be performed with a time interval between them.
I tried using thread to solve my problem, but could not.
This is the code:
protected void PlaySound()
{
List<string> distinctMusic = Music.GetMusicFile.Distinct().ToList();
Thread thrd = new Thread(ThreadTimerMusic);
for (int i = 0; i < distinctMusic.Count; i++)
{
ScriptManager.RegisterClientScriptBlock(Page, GetType(), "playSound", "playSound('" + distinctMusic[i] + "')", true);
thrd.Start(); //Timer
ScriptManager.RegisterClientScriptBlock(Page, GetType(), "stopSound", "stopSound()", true);
i++;
}
}
//Timer 5 seconds.
public void ThreadPlayMusic()
{
Thread.Sleep(5000);
}
Can anyone help me?
Thank you !