/// <summary> /// Use this method when wptList and airportList are entirely changed (probably /// due to loading a different nav data). The downloaded tracks will be reparsed /// and added to the wptList if the specific track system was enabled. /// </summary> public async Task Update(WaypointList wptList, AirportManager airportList, NetworkUpdateAction action) { await queues.WaitForTasks(); var messages = Handlers.Select(h => h.Message).ToList(); this.WptList = wptList; this.AirportList = airportList; SetTrackData(); var newHandlers = Handlers; for (int i = 0; i < messages.Count; i++) { var h = newHandlers[i]; var type = (TrackType)i; var msg = messages[i]; if (msg != null) { // Because the task queue is empty now, we can run everything in // this synchronously. h.GetAllTracks(new TrackMessageProvider(msg), StatusRecorder); h.AddToWaypointList(StatusRecorder); action.SyncTrackEnabled(type); InvokeStatusChanged(type); InvokeTrackMessageUpdated(); } } NavDataChanged?.Invoke(this, EventArgs.Empty); }
public async Task Update(WaypointList wptList, AirportManager airportList) { var action = new NetworkUpdateAction( (t) => SetTrackEnabled(t), (t) => DownloadAndEnableTracks(t)); await airwayNetwork.Update(wptList, airportList, action); }