private void UpdateSimState(BaseSimState simState, bool forceUpdate) { SimCPU.ExtendState(simState); double secs = stopwatch.Elapsed.TotalSeconds; if (secs == 0) { secs = 1; } simState.TotalElapsedSeconds = secs; if (this.Record) { stateQueue.Enqueue(simState); if (stateQueue.Count > MaxHistory) { stateQueue.Dequeue(); // Throw away } } AddWatch(simState); if (forceUpdate) { while (stateQueue.Count > 0) { AddHistory(stateQueue.Dequeue()); } } if (forceUpdate || simState.Tick == 0 || DateTime.Now.Ticks > lastTimeTick + 2500000) { MethodInvoker method = delegate() { UpdateAllDocks(simState); }; BeginInvoke(method); lastTimeTick = DateTime.Now.Ticks; } }