private void OnStateComplete(NativeActivityContext context, ActivityInstance completedInstance, string result) { if (StateMachineIdHelper.IsAncestor(RootId, result)) { int index = StateMachineIdHelper.GetChildStateIndex(RootId, result); context.ScheduleFunc <StateMachineEventManager, string>( _internalStateFuncs[index], _eventManager.Get(context), _onStateComplete); } }
/// <summary> /// Execution of StateMachine /// </summary> /// <param name="context">NativeActivityContext reference</param> //[SuppressMessage("Microsoft.Design", "CA1062:Validate arguments of public methods", MessageId = "0", //Justification = "The context is used by workflow runtime. The parameter should be fine.")] protected override void Execute(NativeActivityContext context) { // We view the duration before moving to initial state is on transition. StateMachineEventManager localEventManager = _eventManager.Get(context); localEventManager.OnTransition = true; localEventManager.CurrentBeingProcessedEvent = null; int index = StateMachineIdHelper.GetChildStateIndex(RootId, this.InitialState.StateId); context.ScheduleFunc <StateMachineEventManager, string>( _internalStateFuncs[index], localEventManager, _onStateComplete); }