/// <summary> /// Removes a logic handler from our list. Logic handlers are automatically removed if they set their state to completed /// </summary> /// <param name="log"></param> /// <returns></returns> public bool RemoveLogic(Logic log) { bool bRet = false; lock (LogicLock) { if (ActiveServices.Contains(log) == true) { ActiveServices.Remove(log); bRet = true; } } return(bRet); }
protected virtual bool OnPresence(PresenceMessage pres) { bool bHandled = false; Logic[] LogicList = null; List <Logic> RemoveList = new List <Logic>(); lock (LogicLock) { LogicList = ActiveServices.ToArray(); } foreach (Logic log in LogicList) { bHandled = log.NewPresence(pres); if (log.IsCompleted == true) { RemoveList.Add(log); } if (bHandled == true) { break; } } lock (LogicLock) { foreach (Logic log in RemoveList) { if (ActiveServices.Contains(log) == true) { ActiveServices.Remove(log); } } } return(bHandled); }