private void MoveCycle() { try { while (Thread.CurrentThread.IsAlive) { MethodInvoker mi = new MethodInvoker(AGVStep); this.BeginInvoke(mi); Thread.Sleep(Convert.ToInt32(txtInterval.Text)); } } catch (ThreadInterruptedException) { } }