public void AddEventHandler(SyncEventHandler h) { //The zero-based index of item in the sorted List<T>, //if item is found; otherwise, a negative number that //is the bitwise complement of the index of the next //element that is larger than item or. int pos = handler.BinarySearch(h); if (pos < 0) { pos = ~pos; } handler.Insert(pos, h); }
/// <summary> /// Initializes a new instance of the <see cref="CmisSync.Lib.Events.RequestIgnoredEvent"/> class. /// </summary> /// <param name="ignoredEvent">Ignored event.</param> /// <param name="reason">Reason why it has been ignored.</param> /// <param name="source">The source which ignored the event.</param> public RequestIgnoredEvent(ISyncEvent ignoredEvent, string reason = null, SyncEventHandler source = null) { if (ignoredEvent == null) { throw new ArgumentNullException("The ignored event cannot be null"); } if (reason == null && source == null) { throw new ArgumentNullException("There must be a reason or source given for the ignored event"); } this.IgnoredEvent = ignoredEvent; this.Reason = (reason != null) ? reason : "Event has been ignored by: " + source.ToString(); }
public void RemoveEventHandler(SyncEventHandler h) { handler.Remove(h); }