void OnConnectClick() { if (model.IsConnected()) // if there is a connection, establish new connections to info and commands { model.StopRead(); Commands.Instance.Reset(); System.Threading.Thread.Sleep(1000); // let info server finish last read } new Thread(delegate() { Commands.Instance.Connect(ApplicationSettingsModel.Instance.FlightServerIP, ApplicationSettingsModel.Instance.FlightCommandPort); // conect to simulator }).Start(); model.Open(ApplicationSettingsModel.Instance.FlightServerIP, ApplicationSettingsModel.Instance.FlightInfoPort); // open info server }