public void Run() { while (true) { if (mc.Map.mc.IsChanged) { foreach (City c in mc.Map.Cities) { c.CityData.Height = mc.Map.mc.AvgHeight; } mc.Map.mc.IsChanged = false; } if (!mc.IsSimulationOn) { break; } int sliderValue = 6; trackBar1.Invoke(new Action(delegate() { sliderValue = trackBar1.Value; })); mc.MakeTimeJump(); label2.Invoke(new Action(delegate() { label2.Text = AddToDate(1); })); cityDataBox.Invoke(new Action(delegate() { RefreshCityDataBox(); })); Thread.Sleep(2000 - 163 * sliderValue); } }