private void RoomRemoved(object sender, EventArgsRoom e) { IList <Source> sourceList = new List <Source>(); lock (this) { e.Room.EventSourceAdded -= SourceAdded; e.Room.EventSourceRemoved -= SourceRemoved; Room room = e.Room as Room; room.Lock(); foreach (Source s in room.SourceList) { if (iSourceList.Remove(s)) { sourceList.Add(s); } } room.Unlock(); } foreach (Source s in sourceList) { if (EventSourceRemoved != null) { EventSourceRemoved(this, new EventArgsSource(s)); } } }
private void RoomAdded(object sender, EventArgsRoom e) { lock (this) { e.Room.EventSourceAdded += SourceAdded; e.Room.EventSourceRemoved += SourceRemoved; } }