private static void FireEvents(List <SchedulerLockGuardInfo> eventList, WorkflowExecutor workflowExec)
        {
            if (!workflowExec.IsInstanceValid && ((workflowExec.WorkflowStatus == WorkflowStatus.Completed) || (workflowExec.WorkflowStatus == WorkflowStatus.Terminated)))
            {
                workflowExec.WorkflowInstance.DeadWorkflow = workflowExec;
            }
            for (int i = 0; i < eventList.Count; i++)
            {
                SchedulerLockGuardInfo info      = eventList[i];
                WorkflowEventInternal  eventType = info.EventType;
                if (eventType != WorkflowEventInternal.Suspended)
                {
                    if (eventType == WorkflowEventInternal.Terminated)
                    {
                        goto Label_0057;
                    }
                    goto Label_008A;
                }
                workflowExec.FireWorkflowSuspended((string)info.EventInfo);
                continue;
Label_0057:
                if (info.EventInfo is Exception)
                {
                    workflowExec.FireWorkflowTerminated((Exception)info.EventInfo);
                }
                else
                {
                    workflowExec.FireWorkflowTerminated((string)info.EventInfo);
                }
                continue;
Label_008A:
                workflowExec.FireWorkflowExecutionEvent(info.Sender, info.EventType);
            }
        }
Пример #2
0
        private static void FireEvents(List <SchedulerLockGuardInfo> eventList, WorkflowExecutor workflowExec)
        {
            if (!workflowExec.IsInstanceValid && (workflowExec.WorkflowStatus == WorkflowStatus.Completed || workflowExec.WorkflowStatus == WorkflowStatus.Terminated))
            {
                // The workflow is dead, let the instance have a hard ref to the corpse for support of the query apis.
                workflowExec.WorkflowInstance.DeadWorkflow = workflowExec;
            }
            for (int i = 0; i < eventList.Count; i++)
            {
                SchedulerLockGuardInfo eseg = eventList[i];
                // eseg.EventInfo is non-null only if the event type is Suspended or Terminated
                // If the event type is Suspended, then call FireWorkflowSuspended after casting
                //   the event argument to a String.
                // If the event type is Terminated, then call FireWorkflowTerminated after casting
                //   the event argument to either a String or an Exception.
                switch (eseg.EventType)
                {
                case WorkflowEventInternal.Suspended:
                    workflowExec.FireWorkflowSuspended((String)eseg.EventInfo);
                    break;

                case WorkflowEventInternal.Terminated:
                    if ((eseg.EventInfo as System.Exception) != null)
                    {
                        workflowExec.FireWorkflowTerminated((Exception)eseg.EventInfo);
                    }
                    else
                    {
                        workflowExec.FireWorkflowTerminated((String)eseg.EventInfo);
                    }
                    break;

                default:
                    workflowExec.FireWorkflowExecutionEvent(eseg.Sender, eseg.EventType);
                    break;
                }
            }
        }