| | | 1 | | using Elsa.Workflows.Activities.Flowchart.Models; |
| | | 2 | | using Elsa.Workflows.Activities.Flowchart.Options; |
| | | 3 | | using Elsa.Workflows.Features; |
| | | 4 | | |
| | | 5 | | namespace Elsa.Workflows.Activities.Flowchart.Extensions; |
| | | 6 | | |
| | | 7 | | /// <summary> |
| | | 8 | | /// Extension methods for <see cref="FlowchartFeature"/>. |
| | | 9 | | /// </summary> |
| | | 10 | | public static class FlowchartFeatureExtensions |
| | | 11 | | { |
| | | 12 | | extension(FlowchartFeature feature) |
| | | 13 | | { |
| | | 14 | | /// <summary> |
| | | 15 | | /// Configures the flowchart options. |
| | | 16 | | /// </summary> |
| | | 17 | | public FlowchartFeature ConfigureFlowchart(Action<FlowchartOptions> configure) |
| | | 18 | | { |
| | 7 | 19 | | feature.FlowchartOptionsConfigurator = configure; |
| | 7 | 20 | | return feature; |
| | | 21 | | } |
| | | 22 | | |
| | | 23 | | /// <summary> |
| | | 24 | | /// Sets the default execution mode for flowcharts to token-based. |
| | | 25 | | /// </summary> |
| | | 26 | | public FlowchartFeature UseTokenBasedExecution() |
| | | 27 | | { |
| | 8 | 28 | | return feature.ConfigureFlowchart(options => options.DefaultExecutionMode = FlowchartExecutionMode.TokenBase |
| | | 29 | | } |
| | | 30 | | |
| | | 31 | | /// <summary> |
| | | 32 | | /// Sets the default execution mode for flowcharts to counter-based (legacy mode). |
| | | 33 | | /// </summary> |
| | | 34 | | public FlowchartFeature UseCounterBasedExecution() |
| | | 35 | | { |
| | 0 | 36 | | return feature.ConfigureFlowchart(options => options.DefaultExecutionMode = FlowchartExecutionMode.CounterBa |
| | | 37 | | } |
| | | 38 | | |
| | | 39 | | /// <summary> |
| | | 40 | | /// Sets the default execution mode for flowcharts to the specified mode. |
| | | 41 | | /// </summary> |
| | | 42 | | public FlowchartFeature UseExecution(FlowchartExecutionMode mode) |
| | | 43 | | { |
| | 0 | 44 | | return feature.ConfigureFlowchart(options => options.DefaultExecutionMode = mode); |
| | | 45 | | } |
| | | 46 | | } |
| | | 47 | | } |