コード例 #1
0
        private void OnTriggerComplete(NativeActivityContext context, System.Activities.ActivityInstance completedInstance)
        {
            int num = this.currentRunningTriggers.Get(context);

            this.currentRunningTriggers.Set(context, --num);
            bool flag = this.isExiting.Get(context);

            if ((!context.IsCancellationRequested && (num == 0)) && flag)
            {
                this.ScheduleExit(context);
            }
            else if (completedInstance.State == ActivityInstanceState.Closed)
            {
                bool flag2;
                InternalTransition transition = null;
                this.triggerInternalTransitionMapping.TryGetValue(completedInstance.Activity, out transition);
                StateMachineEventManager eventManager   = this.EventManager.Get(context);
                TriggerCompletedEvent    completedEvent = new TriggerCompletedEvent {
                    Bookmark  = this.evaluateConditionBookmark.Get(context),
                    TriggedId = transition.InternalTransitionIndex
                };
                eventManager.RegisterCompletedEvent(completedEvent, out flag2);
                if (flag2)
                {
                    ProcessNextTriggerCompletedEvent(context, eventManager);
                }
            }
        }
コード例 #2
0
        private static void ProcessNextTriggerCompletedEvent(NativeActivityContext context, StateMachineEventManager eventManager)
        {
            eventManager.CurrentBeingProcessedEvent = null;
            eventManager.OnTransition = false;
            TriggerCompletedEvent nextCompletedEvent = eventManager.GetNextCompletedEvent();

            if (nextCompletedEvent != null)
            {
                context.GetExtension <StateMachineExtension>().ResumeBookmark(nextCompletedEvent.Bookmark);
            }
        }
コード例 #3
0
 public TriggerCompletedEvent GetNextCompletedEvent()
 {
     while (this.queue.Count > 0)
     {
         TriggerCompletedEvent event2 = this.queue.Dequeue();
         if (this.activeBookmarks.Contains(event2.Bookmark))
         {
             this.CurrentBeingProcessedEvent = event2;
             return(event2);
         }
     }
     return(null);
 }
コード例 #4
0
ファイル: InternalState.cs プロジェクト: dox0/DotNet471RS3
        static void ProcessNextTriggerCompletedEvent(NativeActivityContext context, StateMachineEventManager eventManager)
        {
            eventManager.CurrentBeingProcessedEvent = null;
            eventManager.OnTransition = false;

            TriggerCompletedEvent completedEvent = eventManager.GetNextCompletedEvent();

            if (completedEvent != null)
            {
                StateMachineExtension extension = context.GetExtension<StateMachineExtension>();
                Fx.Assert(extension != null, "Failed to obtain a StateMachineExtension.");
                extension.ResumeBookmark(completedEvent.Bookmark);
            }
        }
コード例 #5
0
        /// <summary>
        /// Gets next completed events queue.
        /// </summary>
        /// <returns>Top TriggerCompletedEvent item in the queue.</returns>
        public TriggerCompletedEvent GetNextCompletedEvent()
        {
            while (this.queue.Any())
            {
                TriggerCompletedEvent completedEvent = this.queue.Dequeue();
                if (this.activeBookmarks.Contains(completedEvent.Bookmark))
                {
                    this.CurrentBeingProcessedEvent = completedEvent;
                    return(completedEvent);
                }
            }

            return(null);
        }
コード例 #6
0
 /// <summary>
 /// Register a completed event and returns whether the event could be processed immediately.
 /// </summary>
 /// <param name="completedEvent">TriggerCompletedEvent reference.</param>
 /// <param name="canBeProcessedImmediately">True if the Condition can be evaluated.</param>
 public void RegisterCompletedEvent(TriggerCompletedEvent completedEvent, out bool canBeProcessedImmediately)
 {
     canBeProcessedImmediately = this.CanProcessEventImmediately;
     this.queue.Enqueue(completedEvent);
     return;
 }
コード例 #7
0
 /// <summary>
 /// Register a completed event and returns whether the event could be processed immediately.
 /// </summary>
 /// <param name="completedEvent">TriggerCompletedEvent reference.</param>
 /// <param name="canBeProcessedImmediately">True if the Condition can be evaluated.</param>
 public void RegisterCompletedEvent(TriggerCompletedEvent completedEvent, out bool canBeProcessedImmediately)
 {
     canBeProcessedImmediately = this.CanProcessEventImmediately;
     this.queue.Enqueue(completedEvent);
     return;
 }