private void SendDivertReport() { string icao = divertAirportCombo.Text; if (icao == "") { MessageBox.Show("You must enter ICAO of the airport you diverted to"); return; } string comment = this.reasonTxt.Text; if (comment == "") { MessageBox.Show("You must enter the reason for divert"); return; } FlightEvent blockOn = FlightTracking.GetFlightEvent("BlockOn"); TimeSpan duration = AcarsBuilder.duration; string durationString = duration.Hours.ToString("00") + ":" + duration.Minutes.ToString("00") + ":" + duration.Seconds.ToString("00"); bool sendDivertResult = Connector.SendDivertReport(icao, comment, pirepId, blockOn.latitude, blockOn.longitude, durationString); if (sendDivertResult) { MessageBox.Show("Divert report has been sent. It is safe to close Šemík now."); this.Close(); } else { MessageBox.Show("Divert report has not been sent. You can try again or see log for details of the error. Contact support if the problem continues."); } }
private void ShowDivert() { this.tabControl.TabPages.Add(this.tabDivert); this.tabControl.SelectedTab = this.tabDivert; string message = "It appears you have not landed on destination airport " + FlightTracking.flightInit.arrival + ".\n"; message += "You can create a divert report here to complete the divert. The report will be sent to the airline staff to approve. Once approved, the flight be logged as diverted, allowing you to continue from the airport, to which you have diverted."; this.divertMessageTxt.Text = message; FlightEvent blockOn = FlightTracking.GetFlightEvent("BlockOn"); XmlNodeList airports = Connector.GetNearestAirport(blockOn.latitude, blockOn.longitude); string errorMessage = "It appears you didn`t land on an airport at all. You can still submit a report, but in the text be more specific about what had happened during your flight."; if (airports == null) { MessageBox.Show(errorMessage); } else { if (airports.Count > 0) { this.divertAirportCombo.Items.Clear(); for (int i = 0; i < airports.Count; i++) { XmlElement airport = (XmlElement)airports[i]; this.divertAirportCombo.Items.Add(airport.GetAttribute("icao")); } this.divertAirportCombo.SelectedItem = this.divertAirportCombo.Items[0]; } else { MessageBox.Show(errorMessage); } } }