Ejemplo n.º 1
0
        protected override void UpdateInstance(NativeActivityUpdateContext updateContext)
        {
            PickState pickState = updateContext.GetValue(this.pickStateVariable);
            Fx.Assert(pickState != null, "Pick's Execute must have run by now.");

            if (updateContext.IsCancellationRequested || pickState.TriggerCompletionBookmark == null)
            {
                // do not schedule newly added Branches once a Trigger has successfully completed.
                return;
            }            

            CompletionCallback onBranchCompleteCallback = new CompletionCallback(OnBranchComplete);
            foreach (PickBranchBody body in this.branchBodies)
            {
                if (updateContext.IsNewlyAdded(body))
                {
                    updateContext.ScheduleActivity(body, onBranchCompleteCallback, null);
                }
            }
        }
Ejemplo n.º 2
0
        protected override void UpdateInstance(NativeActivityUpdateContext updateContext)
        {
            PickState pickState = updateContext.GetValue(this.pickStateVariable);

            Fx.Assert(pickState != null, "Pick's Execute must have run by now.");

            if (updateContext.IsCancellationRequested || pickState.TriggerCompletionBookmark == null)
            {
                // do not schedule newly added Branches once a Trigger has successfully completed.
                return;
            }

            CompletionCallback onBranchCompleteCallback = new CompletionCallback(OnBranchComplete);

            foreach (PickBranchBody body in this.branchBodies)
            {
                if (updateContext.IsNewlyAdded(body))
                {
                    updateContext.ScheduleActivity(body, onBranchCompleteCallback, null);
                }
            }
        }
Ejemplo n.º 3
0
        protected override void UpdateInstance(NativeActivityUpdateContext updateContext)
        {
            if (updateContext.IsCancellationRequested || this.branches == null)
            {
                return;
            }

            if (this.CompletionCondition != null && updateContext.GetValue(this.hasCompleted))
            {
                // when CompletionCondition exists, schedule newly added branches only if "hasCompleted" variable evaluates to false
                return;
            }

            CompletionCallback onBranchComplete = new CompletionCallback(OnBranchComplete);

            foreach (Activity branch in this.branches)
            {
                if (updateContext.IsNewlyAdded(branch))
                {
                    updateContext.ScheduleActivity(branch, onBranchComplete);
                }
            }
        }
Ejemplo n.º 4
0
        private void RescheduleNewlyAddedTriggers(NativeActivityUpdateContext updateContext)
        {
            // NOTE: triggers are scheduled already, so the state has completed executing State.Entry
            Fx.Assert(this.internalTransitions.Count == this.triggerInternalTransitionMapping.Count, "Triggers mappings are correct.");
            List<Activity> newTriggers = new List<Activity>();

            foreach (InternalTransition transition in this.internalTransitions)
            {
                if (updateContext.IsNewlyAdded(transition.Trigger))
                {
                    newTriggers.Add(transition.Trigger);
                }

                // NOTE: all Triggers in triggerInternalTransitionMapping are either new or was previously scheduled
            }

            foreach (Activity newTrigger in newTriggers)
            {
                updateContext.ScheduleActivity(newTrigger, this.onTriggerComplete);
            }

            updateContext.SetValue<int>(this.currentRunningTriggers, updateContext.GetValue(this.currentRunningTriggers) + newTriggers.Count);
        }
Ejemplo n.º 5
0
        protected override void UpdateInstance(NativeActivityUpdateContext updateContext)
        {
            if (updateContext.IsCancellationRequested || this.branches == null)
            {
                return;
            }

            if (this.CompletionCondition != null && updateContext.GetValue(this.hasCompleted))
            {
                // when CompletionCondition exists, schedule newly added branches only if "hasCompleted" variable evaluates to false
                return;
            }           

            CompletionCallback onBranchComplete = new CompletionCallback(OnBranchComplete);

            foreach (Activity branch in this.branches)
            {
                if (updateContext.IsNewlyAdded(branch))
                {
                    updateContext.ScheduleActivity(branch, onBranchComplete);
                }
            }
        }