/// <summary> /// Flight plan is requested from a broadcast by ATC client /// </summary> private async void Hub_OnRequestFlightPlan(string atcConnectionId, string callsign) { if (viewModel.Callsign == callsign) { try { var aircraftData = await flightConnector.RequestAircraftDataAsync(new CancellationTokenSource(5000).Token); var data = await flightConnector.RequestFlightPlanAsync(new CancellationTokenSource(15000).Token); if (data != null) { var flightPlan = new FlightPlanCompact(data, viewModel.Callsign, aircraftData.Title, (int)aircraftData.EstimatedCruiseSpeed, viewModel.Remarks); await hub.SendAsync("ReturnFlightPlan", hub.ConnectionId, flightPlan, new string[] { atcConnectionId }); } } catch (TaskCanceledException ex) { logger.LogError(ex, "Cannot get flight plan for ATC!"); } } }