Beispiel #1
0
        /// <summary>
        /// Sets the special transitions.
        /// </summary>
        /// <param name="specialTransitions">The special transitions.</param>
        internal void SetSpecialTransitions(Dictionary<Guid, AsyncHandlerEarlyExitRequest> specialTransitions)
        {
            var statusMap = new Dictionary<Guid, AsyncHandlerEarlyExitRequest>();
            lock (this._specialTransitionsLock)
            {
                foreach (Guid key in specialTransitions.Keys)
                    statusMap.Add(key, specialTransitions[key]);
            }

            var eventHandler = this.AsyncOperationStatusChanged;
            if (eventHandler == null)
                return;

            var e = new AsyncOperationStatusChangedEventArgs(statusMap);
            eventHandler((object)this, e);
            lock (this._specialTransitionsLock)
            {
                foreach (Guid eventId in e.HandledOperations)
                    this.RemoveSpecialTransitionNoLock(eventId);
            }
        }
Beispiel #2
0
 /// <summary>
 /// Called when [asynchronous operation status changed].
 /// </summary>
 /// <param name="sender">The sender.</param>
 /// <param name="e">The <see cref="AsyncOperationStatusChangedEventArgs"/> instance containing the event data.</param>
 private void OnAsyncOperationStatusChanged(object sender, AsyncOperationStatusChangedEventArgs e)
 {
     var asyncOperationStatusChanged = this.AsyncOperationStatusChanged;
     if (asyncOperationStatusChanged != null)
     {
         try
         {
             asyncOperationStatusChanged(this, e);
         }
         catch (System.Exception ex)
         {
             ErrorAction errorAction = this._errorHandler.Handle(ex);
             if (errorAction.Type == ErrorActionType.Rethrow)
             {
                 throw;
             }
         }
     }
 }