public void Sim() { while (isRunning) { lock (cw) { c.Simulate(); //c.Simulate(); //if (cw != null) cw.RedrawGates(); Thread.Sleep(100); } } }