Beispiel #1
0
        public void Unregister(BaseInformer informer)
        {
            if (!_items.Remove(informer))
            {
                return;
            }

            Stop(informer);
            informer.Changed -= InformerOnChanged;
        }
Beispiel #2
0
        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);
            }
        }
Beispiel #3
0
 private void Stop(BaseInformer informer)
 {
     informer.Stop();
 }
Beispiel #4
0
 private void Start(BaseInformer informer)
 {
     informer.Start();
 }