Exemple #1
0
        private static void CleanUp(ActivityExecutionContext context)
        {
            if (context == null)
            {
                throw new ArgumentNullException("context");
            }
            StateActivity state = (StateActivity)context.Activity;

            if (state.ExecutionStatus == ActivityExecutionStatus.Faulting)
            {
                return; // if we're faulting, then we're already in a bad state, so we don't try to unsubscribe
            }
            StateMachineExecutionState      executionState      = GetExecutionState(state);
            StateMachineSubscriptionManager subscriptionManager = executionState.SubscriptionManager;

            subscriptionManager.UnsubscribeState(context);

            if (StateMachineHelpers.IsRootState(state))
            {
                subscriptionManager.DeleteSetStateEventQueue(context);
            }
            else if (StateMachineHelpers.IsLeafState(state))
            {
                subscriptionManager.UnsubscribeToSetStateEvent(context);
            }
        }
Exemple #2
0
        private static void CleanUp(ActivityExecutionContext context)
        {
            if (context == null)
            {
                throw new ArgumentNullException("context");
            }
            StateActivity state = (StateActivity)context.Activity;

            if (state.ExecutionStatus != ActivityExecutionStatus.Faulting)
            {
                StateMachineSubscriptionManager subscriptionManager = GetExecutionState(state).SubscriptionManager;
                subscriptionManager.UnsubscribeState(context);
                if (StateMachineHelpers.IsRootState(state))
                {
                    subscriptionManager.DeleteSetStateEventQueue(context);
                }
                else if (StateMachineHelpers.IsLeafState(state))
                {
                    subscriptionManager.UnsubscribeToSetStateEvent(context);
                }
            }
        }