/// <summary> /// Enqueues a new event onto the event queue, meaning it falls on the end of the stack. /// This will be later processed through InvokeNext(). /// </summary> /// <param name="eventToBuffer"></param> /// <exception cref="System.ArgumentNullException"></exception> public void Enqueue(Invocation eventToBuffer) { if (eventToBuffer.Target == null) throw new ArgumentNullException("eventToBuffer.Target", "Target of the invocation cannot be null."); lock (this) { if (iterating) iterationBuffer.Enqueue(eventToBuffer); else if (eventToBuffer.DelayTimeMs > 0) waitBuffer.Add(eventToBuffer); else events.Enqueue(eventToBuffer); } }
/// <summary> /// Enqueue a new invocation onto the event queue. /// </summary> /// <param name="target"></param> /// <param name="parameter"></param> /// <exception cref="System.ArgumentNullException"></exception> public void Enqueue(Invocation.InvocationTarget target, object parameter) { if (target == null) throw new ArgumentNullException("target", "Target of the invocation cannot be null!"); Invocation inv = new Invocation(target, parameter); Enqueue(inv); }