Example #1
0
        public IWorkflowBlueprint Build(IWorkflow workflow, string activityIdPrefix)
        {
            var workflowTypeName = workflow.GetType().Name;

            Name ??= workflowTypeName;
            DisplayName ??= workflowTypeName;

            WithId(workflowTypeName);
            workflow.Build(this);
            return(BuildBlueprint(activityIdPrefix));
        }
Example #2
0
        void RemoveWorkflow()
        {
            //stop the current workflow
            IWorkflow current = null;

            if (!_workflows.TryDequeue(out current))
            {
                return;
            }
            current.StopWorkflow();

            //remove old workflows no longer active
            var pruning = true;

            while (pruning)
            {
                if (!_workflows.TryPeek(out current))
                {
                    return;
                }
                if (current != Get(current.GetType()))
                {
                    _workflows.TryDequeue(out current);
                }
                else
                {
                    pruning = false;
                }
            }

            //start the next workflow
            if (!_workflows.TryPeek(out current))
            {
                return;
            }
            current.StartWorkflow(new WorkflowManager(() => Remove(current as IBehavior)));
        }
Example #3
0
 public void Execute(IWorkflow <string> workflow, StateChangeEventArgs <string> transition)
 {
     Console.WriteLine("Mail action executed: {0}. Context: {1}", workflow.GetType().Name, workflow.Context.GetType().Name);
 }
Example #4
0
 public ElsaOptionsBuilder AddWorkflow(IWorkflow workflow)
 {
     Services.AddSingleton(workflow);
     ElsaOptions.WorkflowFactory.Add(workflow.GetType(), workflow);
     return(this);
 }
Example #5
0
 public void Execute(IWorkflow <string, Customer> workflow, WorkflowTransition <string, Customer> transition)
 {
     WriteLine($"ActionThree action executed: {workflow.GetType().Name}. Context Object: {workflow.Context.GetType().Name}");
 }