public void RemvoveEvent(ClockEvent eventClock) { object clockLock = this.clockLock; lock (clockLock) { if (this.eventList.Contains(eventClock)) { int index = this.eventList.FindIndex(tmpEvent => tmpEvent == eventClock); if (index > -1) { this.eventList.RemoveAt(index); this.eventTimeList.RemoveAt(index); } } } }
public void AddNewEvent(ClockEvent eventClock) { object clockLock = this.clockLock; lock (clockLock) { int insertInTimeListIndex = this.GetInsertInTimeListIndex(eventClock.DelayTime + this.clockSecond); if (insertInTimeListIndex > -1) { this.eventList.Insert(insertInTimeListIndex, eventClock); } else { this.eventList.Add(eventClock); } this.specialCount++; } }