예제 #1
0
        static void ProcessNextTriggerCompletedEvent(NativeActivityContext context, StateMachineEventManager eventManager)
        {
            eventManager.CurrentBeingProcessedEvent = null;
            eventManager.OnTransition = false;

            TriggerCompletedEvent completedEvent = eventManager.GetNextCompletedEvent();

            if (completedEvent != null)
            {
                context.ResumeBookmark(completedEvent.Bookmark, null);
            }
        }
예제 #2
0
 /// <summary>
 /// Get next completed events queue.
 /// </summary>
 public TriggerCompletedEvent GetNextCompletedEvent()
 {
     while (this.queue.Count > 0)
     {
         TriggerCompletedEvent completedEvent = this.queue.Dequeue();
         if (this.activeBookmarks.Contains(completedEvent.Bookmark))
         {
             this.CurrentBeingProcessedEvent = completedEvent;
             return(completedEvent);
         }
     }
     return(null);
 }
예제 #3
0
 /// <summary>
 /// Register a completed event and returns whether the event could be processed immediately.
 /// </summary>
 public void RegisterCompletedEvent(TriggerCompletedEvent completedEvent, out bool canBeProcessedImmediately)
 {
     if (CanProcessEventImmediately)
     {
         this.CurrentBeingProcessedEvent = completedEvent;
         canBeProcessedImmediately = true;
         return;
     }
     else if (queue.Count < MaxQueueLength)
     {
         this.queue.Enqueue(completedEvent);
         canBeProcessedImmediately = false;
         return;
     }
     canBeProcessedImmediately = false;
     throw new InvalidOperationException(string.Format(CultureInfo.CurrentCulture, SR.TooManyCompletedEvents, MaxQueueLength));
 }
예제 #4
0
 /// <summary>
 /// Register a completed event and returns whether the event could be processed immediately.
 /// </summary>
 public void RegisterCompletedEvent(TriggerCompletedEvent completedEvent, out bool canBeProcessedImmediately)
 {
     if (CanProcessEventImmediately)
     {
         this.CurrentBeingProcessedEvent = completedEvent;
         canBeProcessedImmediately       = true;
         return;
     }
     else if (queue.Count < MaxQueueLength)
     {
         this.queue.Enqueue(completedEvent);
         canBeProcessedImmediately = false;
         return;
     }
     canBeProcessedImmediately = false;
     throw new InvalidOperationException(string.Format(CultureInfo.CurrentCulture, SR.TooManyCompletedEvents, MaxQueueLength));
 }