void OnConnectClick() { // If there is a connection with the flight simulator: if (flightBoardModel.IsSimulatorConnected()) { flightBoardModel.StopGetInfo(); CommandsClient.Instance.Initialize(); System.Threading.Thread.Sleep(1000); } // Open a new thread, connect the commands client to the simulator and open the info server. new Thread(delegate() { CommandsClient.Instance.Connect(ApplicationSettingsModel.Instance.FlightServerIP, ApplicationSettingsModel.Instance.FlightCommandPort); }).Start(); flightBoardModel.OpenServer(ApplicationSettingsModel.Instance.FlightServerIP, ApplicationSettingsModel.Instance.FlightInfoPort); }