private void SetCurrentSim(Simulator simulator, string seedcaps) { if (simulator != CurrentSim) { Simulator oldSim = CurrentSim; lock (Simulators) CurrentSim = simulator; // CurrentSim is synchronized against Simulators simulator.setSeedCaps(seedcaps); // If the current simulator changed fire the callback if (OnCurrentSimChanged != null && simulator != oldSim) { try { OnCurrentSimChanged(oldSim); } catch (Exception e) { Client.Log(e.ToString(), Helpers.LogLevel.Error); } } } }