/// <summary>
 /// Removes a listener
 /// </summary>
 public void RemoveListener(IListener listener)
 {
     if (Listeners.Contains(listener))
     {
         Listeners.Remove(listener);
     }
 }
Esempio n. 2
0
 /// <summary>
 /// Asks the user which listener to delete.
 /// </summary>
 public void DelListener(string id)
 {
     //Console.WriteLine("Please enter the ID of the listener you want to delete:\r\n (use the 'listlisteners' command to show all the listener IDs)");
     if (id != "")
     {
         try {
             ListenEntry le = new ListenEntry();
             le.guid = new Guid(id);
             if (!Listeners.Contains(le))
             {
                 Console.WriteLine("Specified ID not found in list!");
                 return;
             }
             else
             {
                 this[Listeners.IndexOf(le)].Dispose();
                 Listeners.Remove(le);
                 Config.SaveData();
             }
         } catch {
             Console.WriteLine("Invalid ID tag!");
             return;
         }
         Console.WriteLine("Listener removed from the list.");
     }
 }
Esempio n. 3
0
        private void RemoveFrom(int currentSourceIndex)
        {
            int numRemoved = 0;

            lock (_indices)
            {
                while (_indices.Count > 0)
                {
                    int i           = _indices.Count - 1;
                    int sourceIndex = _indices[i];
                    if (sourceIndex >= currentSourceIndex)
                    {
                        if (_logEntryIndices.TryGetValue(sourceIndex, out var previousLogEntryIndex))
                        {
                            _currentLogEntryIndex = previousLogEntryIndex;
                        }
                        _logEntryIndices.Remove(sourceIndex);

                        _indices.RemoveAt(i);
                        ++numRemoved;
                    }
                    else
                    {
                        break;
                    }
                }
            }
            Listeners.Remove(_indices.Count, numRemoved);
        }
        private bool Process(IReadOnlyList <LogSourceModification> pendingModifications)
        {
            if (pendingModifications.Count == 0)
            {
                return(false);
            }

            foreach (var modification in pendingModifications)
            {
                if (modification.IsReset())
                {
                    _count = 0;
                    Listeners.Reset();
                    _propertiesBuffer.SetToDefault(_adornedProperties);
                    SynchronizeProperties();
                }
                else if (modification.IsRemoved(out var removedSection))
                {
                    _count = (int)removedSection.Index;
                    SynchronizeProperties();
                    Listeners.Remove((int)removedSection.Index, removedSection.Count);
                }
                else if (modification.IsAppended(out var appendedSection))
                {
                    Process(appendedSection);
                    _count += appendedSection.Count;
                    SynchronizeProperties();
                    Listeners.OnRead(_count);
                }
            }

            return(true);
        }
        public override void Deregister(Action <TEntity> action)
        {
            var listener = new AddedActionEventDelegator <TEntity>(action);

            if (!Listeners.Contains(listener))
            {
                Listeners.Remove(listener);
            }
        }
Esempio n. 6
0
 public void RemoveListener(IDomainEventListener listener)
 {
     lock (Listeners) {
         if (Listeners.Contains(listener))
         {
             Listeners.Remove(listener);
         }
     }
 }
Esempio n. 7
0
        private void RemoveLast()
        {
            var index = _entries.Count - 1;

            lock (_syncRoot)
            {
                _entries.RemoveAt(index);
            }
            Listeners.Remove(index, 1);
        }
Esempio n. 8
0
 /// <summary>
 /// Removes a listener for the value change.
 /// <para>
 /// If the same listener was added more than once,
 /// it will be notified one less time after being removed.
 /// If {@code listener} is {@code null}, or was never added,
 /// no exception is thrown and no action is taken.
 ///
 /// </para>
 /// </summary>
 /// <param name="listener">  the <seealso cref="PropertyChangeListener"/> to remove </param>
 public virtual void RemovePropertyChangeListener(PropertyChangeListener listener)
 {
     lock (this)
     {
         if (Listeners == null)
         {
             return;
         }
         Listeners.Remove(listener);
     }
 }
Esempio n. 9
0
        public void UnregisterListener(ITrackerListener listener)
        {
            CheckDisposed();
            if (listener == null)
            {
                throw new ArgumentNullException("listener");
            }

            listener.AnnounceReceived -= ListenerReceivedAnnounce;
            listener.ScrapeReceived   -= ListenerReceivedScrape;
            Listeners.Remove(listener);
        }
Esempio n. 10
0
 public void RemoveEventListener(string eventName)
 {
     if (Listeners[eventName] != null)
     {
         OnMessage -= Listeners[eventName];
         Listeners.Remove(eventName);
     }
     else
     {
         throw new Exception("Event Name is not present in dictionary. Consider using a GUID to ensure a unique number is generated");
     }
 }
Esempio n. 11
0
        private void Remove(LogSourceSection sectionToRemove)
        {
            var firstRemovedIndex   = LogLineIndex.Min(_fullSourceSection.LastIndex, sectionToRemove.Index);
            var lastRemovedIndex    = LogLineIndex.Min(_fullSourceSection.LastIndex, sectionToRemove.LastIndex);
            var removedCount        = lastRemovedIndex - firstRemovedIndex + 1;
            var previousSourceIndex = _currentSourceIndex;

            _fullSourceSection = new LogSourceSection(0, (int)firstRemovedIndex);
            if (_fullSourceSection.Count > 0)
            {
                // It's possible (likely) that we've received an invalidation for a region of the source
                // that we've already processed (i.e. created indices for). If that's the case, then we need
                // to rewind the index. Otherwise nothing needs to be done...
                var newIndex = _fullSourceSection.LastIndex + 1;
                if (newIndex < _currentSourceIndex)
                {
                    _currentSourceIndex = newIndex;
                }
            }
            else
            {
                _currentSourceIndex = 0;
            }

            lock (_syncRoot)
            {
                var toRemove = _indices.Count - lastRemovedIndex;
                if (toRemove > 0)
                {
                    _indices.RemoveRange((int)firstRemovedIndex, toRemove);
                    _currentLogEntry = new LogEntryInfo(firstRemovedIndex - 1, 0);
                }
                if (previousSourceIndex != _currentSourceIndex)
                {
                    _indices.RemoveRange((int)_currentSourceIndex, _indices.Count - _currentSourceIndex);
                }
            }

            if (_indices.Count != _currentSourceIndex)
            {
                Log.ErrorFormat("Inconsistency detected: We have {0} indices for {1} lines", _indices.Count,
                                _currentSourceIndex);
            }

            Listeners.Remove((int)firstRemovedIndex, removedCount);

            if (_fullSourceSection.Count > firstRemovedIndex)
            {
                _fullSourceSection = new LogSourceSection(0, firstRemovedIndex.Value);
            }
        }
Esempio n. 12
0
 public static void RemoveUserFromListeners(string email, string connectionId)
 {
     lock (Listeners)
     {
         if (Listeners.ContainsKey(email) && Listeners[email].ContainsKey(connectionId))
         {
             Listeners[email].Remove(connectionId);
             if (Listeners[email].Count == 0)
             {
                 Listeners.Remove(email);
             }
         }
     }
 }
Esempio n. 13
0
    void UnregisterImpl(string channel, IListener listener)
    {
        if (string.IsNullOrEmpty(channel) == true)
        {
            return;
        }
        if (m_Channels.ContainsKey(channel) == false)
        {
            return;
        }

        Listeners listeners = m_Channels[channel];

        listeners.Remove(listener);
    }
Esempio n. 14
0
        private void RemoveSection(LogSourceSection section)
        {
            _count = (int)section.Index;
            try
            {
                OnSectionRemoved(_count);
            }
            catch (Exception e)
            {
                Log.WarnFormat("Caught unexpected exception: {0}", e);
            }

            SynchronizeProperties();
            Listeners.Remove((int)section.Index, section.Count);
        }
Esempio n. 15
0
 public void RemoveObject(LevelObject levelObject)
 {
     if (levelObject is Area)
     {
         Areas.Remove(levelObject as Area);
     }
     else if (levelObject is Entity)
     {
         Entities.Remove(levelObject as Entity);
     }
     else if (levelObject is Listener)
     {
         Listeners.Remove(levelObject as Listener);
     }
 }
Esempio n. 16
0
    public virtual void HandleQvent(Qvent qvent)
    {
        switch (qvent.QventType)
        {
        case QventType.DAMAGED:
            SetState(ShipState.COMBAT);
            CombatCooldownTimer = SpaceGameGlobal.COMBAT_COOLDOWN;
            break;

        case QventType.DESTROYED:
            if (qvent.PayloadType.IsAssignableFrom(typeof(Ship)))
            {
                Listeners.Remove((Ship)qvent.Payload);
            }
            break;
        }
    }
Esempio n. 17
0
 private void NotifyListeners(IEnumerable <LogSourceModification> changes)
 {
     foreach (var section in changes)
     {
         if (section.IsRemoved(out var removedSection))
         {
             Listeners.Remove((int)removedSection.Index, removedSection.Count);
         }
         else if (section.IsReset())
         {
             Listeners.Reset();
         }
         else if (section.IsAppended(out var appendedSection))
         {
             Listeners.OnRead((int)(appendedSection.Index + appendedSection.Count));
         }
     }
 }
Esempio n. 18
0
        /// <summary>
        /// Removes an event listener from this object.
        /// </summary>
        /// <param name="eventName">Name of the event</param>
        /// <param name="callback">Callback that fires when the event is triggered.</param>
        /// <param name="options"></param>
        public void removeEventListener(EventName eventName, EventCallback callback, EventListenerOptions options = null)
        {
            bool capture = false;

            if (!ReferenceEquals(options, null))
            {
                capture = options.capture;
            }

            /* 3) If the context object’s event listener list contains an event listener whose type is type, callback is callback, and capture is capture, then remove an event listener with the context object and that event listener. */
            var found = Find_Listener(eventName, callback, capture);

            if (!ReferenceEquals(found, null))
            {
                found.removed = true;
                Listeners.Remove(found);
            }
        }
Esempio n. 19
0
 public void Leave(string connectionId)
 {
     lock (Loginstate)
     {
         var index = Feeders.IndexOf(connectionId);
         if (index != -1)
         {
             Feeders.Remove(connectionId);
         }
         else
         {
             index = Listeners.IndexOf(connectionId);
             if (index != -1)
             {
                 Listeners.Remove(connectionId);
             }
         }
     }
 }
        /// <summary>
        /// Remove all interfaces attached the global listener gameobject.
        /// If no interface is found, remove is ignored.
        /// </summary>
        /// <param name="gameObjectToRemove">The gameobject which listens globally.</param>
        public void Remove(GameObject gameObjectToRemove)
        {
            if (gameObjectToRemove == null)
            {
                return;
            }

            // todo: macht wenig sinn alles zu löschen
            //RemoveEmptyListeners();

            IStylusInputHandler[] inputHandlers = gameObjectToRemove.GetComponents <IStylusInputHandler>();

            if (inputHandlers == null)
            {
                return;
            }

            DeregisterInputHandlers(inputHandlers);
            Listeners.Remove(gameObjectToRemove);
        }
Esempio n. 21
0
        private void ProcessPendingSections(out bool workDone)
        {
            workDone = false;
            while (_pendingSections.TryDequeue(out var pair))
            {
                // We may still have pending sections from a log file we've just removed as listener.
                // If that's the case, then throw away that section and go look for the next...
                if (!Equals(pair.Key, _finalLogSource))
                {
                    continue;
                }

                var modification = pair.Value;
                if (modification.IsReset())
                {
                    Listeners.Reset();
                    _count = 0;
                    _maxCharactersInLine = 0;
                }
                else if (modification.IsRemoved(out var removedSection))
                {
                    Listeners.Remove((int)removedSection.Index, removedSection.Count);
                    _count = (int)removedSection.Index;
                    // TODO: What about max width?
                }
                else if (modification.IsAppended(out var appendedSection))
                {
                    Listeners.OnRead(appendedSection.LastIndex);
                    _count = (int)(appendedSection.Index + appendedSection.Count);
                    UpdateMaxWidth(appendedSection, pair.Key);
                }

                workDone = true;
            }

            if (!workDone)
            {
                Listeners.OnRead(_count);
            }
        }
Esempio n. 22
0
        /// <summary>
        /// Main actor receive method
        /// </summary>
        /// <param name="message"></param>
        protected override bool Receive(object message)
        {
            var match = PatternMatch.Match(message)
                        .With <TimeoutMarker>(marker =>
            {
                if (_generation == marker.Generation)
                {
                    ProcessMsg(new StateTimeout(), "state timeout");
                }
            })
                        .With <Timer>(t =>
            {
                if (_timers.ContainsKey(t.Name) && _timers[t.Name].Generation == t.Generation)
                {
                    if (_timeoutFuture != null)
                    {
                        _timeoutFuture.Cancel(false);
                        _timeoutFuture = null;
                    }
                    _generation++;
                    if (!t.Repeat)
                    {
                        _timers.Remove(t.Name);
                    }
                    ProcessMsg(t.Message, t);
                }
            })
                        .With <SubscribeTransitionCallBack>(cb =>
            {
                Context.Watch(cb.ActorRef);
                Listeners.Add(cb.ActorRef);
                //send the current state back as a reference point
                cb.ActorRef.Tell(new CurrentState <TState>(Self, _currentState.StateName));
            })
                        .With <Listen>(l =>
            {
                Context.Watch(l.Listener);
                Listeners.Add(l.Listener);
                l.Listener.Tell(new CurrentState <TState>(Self, _currentState.StateName));
            })
                        .With <UnsubscribeTransitionCallBack>(ucb =>
            {
                Context.Unwatch(ucb.ActorRef);
                Listeners.Remove(ucb.ActorRef);
            })
                        .With <Deafen>(d =>
            {
                Context.Unwatch(d.Listener);
                Listeners.Remove(d.Listener);
            })
                        .With <InternalActivateFsmLogging>(_ => { DebugEvent = true; })
                        .Default(msg =>
            {
                if (_timeoutFuture != null)
                {
                    _timeoutFuture.Cancel(false);
                    _timeoutFuture = null;
                }
                _generation++;
                ProcessMsg(msg, Sender);
            });

            return(match.WasHandled);
        }
 public void UnregisterListener(GameEventListenerBool listener)
 {
     Listeners.Remove(listener);
 }
 public void UnregisterListener(GameEventListenerTransform listener)
 {
     Listeners.Remove(listener);
 }
Esempio n. 25
0
 public void UnregisterListener(GameEventListenerObject listener)
 {
     Listeners.Remove(listener);
 }
Esempio n. 26
0
 public void RemoveListener(Listener listener)
 {
     listener.Stop();
     Listeners.Remove(listener);
 }
Esempio n. 27
0
 public void UnregisterListener(GameEventListenerString listener)
 {
     Listeners.Remove(listener);
 }
Esempio n. 28
0
 public void Unregister(IPeerListener listener)
 {
     listener.ConnectionReceived -= ConnectionReceived;
     Listeners.Remove(listener);
 }
        /// <summary>
        /// Attempts to remove the specified listener, if managed by this request.
        /// </summary>
        public bool Unlisten(CacheListener <T> listener)
        {
            AssertNotDisposed();

            return(Listeners.Remove(listener));
        }
Esempio n. 30
0
 public void UnregisterListener(GameEventListenerVector3 listener)
 {
     Listeners.Remove(listener);
 }