Exemplo n.º 1
0
        void RemoveActiveBookmark(ActivityContext context)
        {
            StateMachineEventManager eventManager = this.EventManager.Get(context);
            Bookmark bookmark = this.evaluateConditionBookmark.Get(context);

            if (bookmark != null)
            {
                eventManager.RemoveActiveBookmark(bookmark);
            }
        }
Exemplo n.º 2
0
        protected override void Execute(NativeActivityContext context)
        {
            //We view the duration before moving to initial state is on transition.
            StateMachineEventManager localEventManager = this.eventManager.Get(context);

            localEventManager.OnTransition = true;
            int index = StateMachineHelper.GetChildStateIndex(rootId, this.InitialState.StateId);

            context.ScheduleFunc <string, StateMachineEventManager, string>(this.internalStateFuncs[index], this.InitialState.StateId,
                                                                            localEventManager, onStateComplete);
        }
Exemplo n.º 3
0
 void TakeTransition(NativeActivityContext context, StateMachineEventManager eventManager, int triggerId)
 {
     this.EventManager.Get(context).OnTransition = true;
     if (!this.hasRunningChildState.Get(context))
     {
         PrepareForExit(context, GetTo(triggerId, eventManager.CurrentConditionIndex));
     }
     else
     {
         context.ResumeBookmark(this.EventManager.Get(context).CompleteDeepestChildBookmark, GetTo(triggerId, eventManager.CurrentConditionIndex));
     }
 }
Exemplo n.º 4
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);
            }
        }
Exemplo n.º 5
0
        void ScheduleAction(NativeActivityContext context)
        {
            StateMachineEventManager eventManager = this.EventManager.Get(context);

            if (eventManager.IsReferredByBeingProcessedEvent(this.evaluateConditionBookmark.Get(context)))
            {
                InternalTransition transition = GetInternalTransition(eventManager.CurrentBeingProcessedEvent.TriggedId);
                Activity           action     = transition.TransitionDataList[eventManager.CurrentConditionIndex].Action;
                if (action != null)
                {
                    context.ScheduleActivity(action);
                }
            }
            RemoveBookmarks(context);
        }
Exemplo n.º 6
0
        void StartEvaluateCondition(NativeActivityContext context)
        {
            //Start to evaluate conditions of the trigger which represented by currentTriggerIndex
            StateMachineEventManager eventManager = this.EventManager.Get(context);
            int triggerId = eventManager.CurrentBeingProcessedEvent.TriggedId;

            eventManager.CurrentConditionIndex = 0;
            InternalTransition transition = GetInternalTransition(triggerId);

            if (transition.IsUnconditional)
            {
                TakeTransition(context, eventManager, triggerId);
            }
            else
            {
                context.ScheduleActivity <bool>(GetCondition(triggerId, eventManager.CurrentConditionIndex),
                                                this.onConditionComplete, null);
            }
        }