// Connect to the simulator using a new thread. void ConnectToSimulator() { // If there is a connection, reset it and reconnect. if (model.ConnectionExists()) { // Stop the connection. model.HaltConnection(); // Reset it. CommandsServer.Instance.ResetConnection(); // Let the thread finish. System.Threading.Thread.Sleep(1000); } // Create a new thread, and run the new connection on it. newthread = new Thread(() => CommandsServer.Instance.ConnectToSimulator(ApplicationSettingsModel.Instance.FlightServerIP, ApplicationSettingsModel.Instance.FlightCommandPort)); newthread.Start(); model.StartConnection(ApplicationSettingsModel.Instance.FlightServerIP, ApplicationSettingsModel.Instance.FlightInfoPort); }