public void Wait(uint milsecond)
{
long waittick = (long)10000 * milsecond;
long tick = DateTime.Now.Ticks;
while (tick + waittick > DateTime.Now.Ticks)
{
System.Threading.Thread.Sleep(100);
System.Windows.Forms.Application.DoEvents();
}
}