Exemplo n.º 1
0
 public static void RemoveFixture(string id)
 {
     lock (_locker)
     {
         if (!Contains(id))
         {
             return;
         }
         FixtureControlItem <StreamListener> item = null;
         _fixtureTasks.TryRemove(id, out item);
         _logger.InfoFormat("Removed fixtureId={0} from controller", id);
     }
 }
 public static void AddListener(string id, Func<StreamListener> createListener)
 {
     var fixtureControlItem = new FixtureControlItem<StreamListener>(id, createListener, FixtureStatus.Active);
     lock (_lockAddItem)
     {
         if (!_fixtureTasks.ContainsKey(id))
             _fixtureTasks[id] = fixtureControlItem;
         else
         {
             _logger.InfoFormat("Disabling duplicated streaming listener for fixtureId={0}",id);
             fixtureControlItem.Item.StopListening();
             _logger.InfoFormat("Disabled duplicated streaming listener for fixtureId={0}", id);
         }
     }
 }
Exemplo n.º 3
0
        public static void AddListener(string id, Func <StreamListener> createListener)
        {
            var fixtureControlItem = new FixtureControlItem <StreamListener>(id, createListener, FixtureStatus.Active);

            lock (_lockAddItem)
            {
                if (!_fixtureTasks.ContainsKey(id))
                {
                    _fixtureTasks[id] = fixtureControlItem;
                }
                else
                {
                    _logger.InfoFormat("Disabling duplicated streaming listener for fixtureId={0}", id);
                    fixtureControlItem.Item.StopListening();
                    _logger.InfoFormat("Disabled duplicated streaming listener for fixtureId={0}", id);
                }
            }
        }