/// <summary> /// See interface docs. /// </summary> /// <param name="receiver"></param> /// <param name="configuration"></param> public void ApplyConfiguration(Receiver receiver, Configuration configuration) { if (!_Initialised) { throw new InvalidOperationException("ApplyConfiguration cannot be called on an uninitialised feed"); } if (receiver == null) { throw new ArgumentNullException("receiver"); } if (configuration == null) { throw new ArgumentNullException("configuration"); } if (receiver.UniqueId != UniqueId) { throw new InvalidOperationException($"Cannot apply configuration for receiver #{receiver.UniqueId} to feed for receiver for #{UniqueId}"); } var receiverLocation = configuration.ReceiverLocation(receiver.ReceiverLocationId); var initialisedWithReceiver = (Listener as IMergedFeedListener) == null; if (!initialisedWithReceiver) { throw new InvalidOperationException("Feed {UniqueId} was initialised with a merged feed but updated with a receiver"); } var nameChanged = !String.IsNullOrEmpty(Name) && Name != receiver.Name; if (nameChanged) { SaveCurrentPolarPlot(); } Name = receiver.Name; ApplyReceiverListenerSettings(true, receiver, configuration, receiverLocation); if (receiver.ReceiverUsage == ReceiverUsage.MergeOnly) { AircraftList.Stop(); } else { AircraftList.Start(); } ConfigurePolarPlotter(receiverLocation, nameChanged); }
/// <summary> /// Performs initialisation common to all Initialise methods. /// </summary> /// <param name="uniqueId"></param> /// <param name="name"></param> /// <param name="isSatcomFeed"></param> /// <param name="receiverUsage"></param> /// <param name="startAircraftList"></param> private void DoCommonInitialise(int uniqueId, string name, bool isSatcomFeed, ReceiverUsage receiverUsage, bool startAircraftList) { _Initialised = true; UniqueId = uniqueId; Name = name; Listener.ReceiverId = uniqueId; Listener.ReceiverName = Name; Listener.IsSatcomFeed = isSatcomFeed; AircraftList = Factory.Resolve <IBaseStationAircraftList>(); AircraftList.ExceptionCaught += AircraftList_ExceptionCaught; AircraftList.Listener = Listener; AircraftList.StandingDataManager = Factory.ResolveSingleton <IStandingDataManager>(); SetIsVisible(receiverUsage); if (startAircraftList) { AircraftList.Start(); } }