// Send XML to Mobile Device public void SendInspectionData() { DialogResult dr = new DialogResult(); ToMobileView SendInspectionDialog = new ToMobileView(); dr = SendInspectionDialog.ShowDialog(); if (dr == DialogResult.OK) { if (SendInspectionDialog.PortNumber.Text != "" & SendInspectionDialog.IPAddress.Text != "") { try { int port = Convert.ToInt32(SendInspectionDialog.PortNumber.Text); String IP = SendInspectionDialog.IPAddress.Text; FAFOS.TCP_Model my_model = new FAFOS.TCP_Model(IP, port); String XMLdata = XML.SendInspection(); my_model.Send_to_TCP(XMLdata); my_model.shutdown(); } catch (Exception ex) { MessageBox.Show("Make sure the Mobile device is up and listening\r\nand the server IP address and port number are correct\n\n", "<<CONNECTION ERROR>>"); } } else { MessageBox.Show("You must enter a valid port number and IP address"); } } else if (dr == DialogResult.Cancel) { SendInspectionDialog.Dispose(); } }