/// <summary> /// Creates the asynchronous event operation. /// </summary> /// <param name="asyncEvent">The asynchronous event.</param> /// <param name="poolHandler">The pool handler.</param> /// <returns></returns> public IThreadPoolOperation CreateAsyncEventOperation(AsyncEvent asyncEvent, IAsyncEventExecutionEngine poolHandler) { var asyncEventOperation = new AsyncEventOperation(asyncEvent, poolHandler, this.EventLog); this.ApplyBehaviors(asyncEventOperation); return asyncEventOperation; }
/// <summary> /// Initializes a new instance of the <see cref="AsyncEventOperation"/> class. /// </summary> /// <param name="asyncEvent">The asynchronous event.</param> /// <param name="poolHandler">The pool handler.</param> /// <param name="eventLog">The event log.</param> public AsyncEventOperation(AsyncEvent asyncEvent, IAsyncEventExecutionEngine poolHandler, IMyEventLog eventLog) : base("AsyncEventOperation", eventLog) { AsyncEventOperation asyncEventOperation = this; this.AsyncEvent = asyncEvent; this._poolHander = poolHandler; this._eventAction = operation => asyncEventOperation.ReuseResource = !(asyncEventOperation._poolHander.ProcessAsyncEvent(asyncEvent) is AsyncInProgressResult); }