public void Unregister(BaseInformer informer) { if (!_items.Remove(informer)) { return; } Stop(informer); informer.Changed -= InformerOnChanged; }
public void Register(BaseInformer informer) { if (informer == null) { throw new ArgumentNullException(nameof(informer)); } if (_items.Any(x => string.Equals(x.Name, informer.Name, StringComparison.InvariantCultureIgnoreCase))) { throw new ArgumentException("Informer with same name already registered.", nameof(informer)); } _items.Add(informer); informer.Changed += InformerOnChanged; if (Started) { Start(informer); } else { Stop(informer); } }
private void Stop(BaseInformer informer) { informer.Stop(); }
private void Start(BaseInformer informer) { informer.Start(); }