|
1 | | -namespace Moryx.AbstractionLayer |
| 1 | +using System.Collections.Generic; |
| 2 | + |
| 3 | +namespace Moryx.AbstractionLayer |
2 | 4 | { |
3 | 5 | /// <summary> |
4 | 6 | /// Extensions for <see cref="IProcess"/> |
5 | 7 | /// </summary> |
6 | 8 | public static class ProcessExtensions |
7 | 9 | { |
8 | 10 | /// <summary> |
9 | | - /// Prepared activity that will be dispatched as soon as a ready to work was send. |
| 11 | + /// Get one prepared activity that will be dispatched as soon as a ready to work was send. |
| 12 | + /// Mention that, in case of parallel path in a workplan, a process could have multiple prepared activities! |
| 13 | + /// See also: <seealso cref="NextActivities"/> |
10 | 14 | /// </summary> |
| 15 | + /// <returns>Last activity of the process that is prepared</returns> |
11 | 16 | public static IActivity NextActivity(this IProcess process) |
12 | 17 | { |
13 | 18 | return process.GetActivity(ActivitySelectionType.LastOrDefault, activity => activity.Tracing?.Started == null); |
14 | 19 | } |
15 | 20 |
|
16 | 21 | /// <summary> |
17 | | - /// Current running activity |
| 22 | + /// Get all prepared activities that will be dispatched as soon as a ready to work was send. |
| 23 | + /// </summary> |
| 24 | + public static IEnumerable<IActivity> NextActivities(this IProcess process) |
| 25 | + { |
| 26 | + return process.GetActivities(activity => activity.Tracing?.Started == null); |
| 27 | + } |
| 28 | + |
| 29 | + /// <summary> |
| 30 | + /// Get one of the current running activities of the process. |
| 31 | + /// Mention that, in case of parallel path in a workplan, a process could have multiple running activities! |
| 32 | + /// See also: <seealso cref="CurrentActivities"/> |
18 | 33 | /// </summary> |
| 34 | + /// <returns>Last activity of the process that is running</returns> |
19 | 35 | public static IActivity CurrentActivity(this IProcess process) |
20 | 36 | { |
21 | 37 | return process.GetActivity(ActivitySelectionType.LastOrDefault, activity => activity.Tracing?.Started != null && activity.Result == null); |
22 | 38 | } |
23 | 39 |
|
| 40 | + /// <summary> |
| 41 | + /// Get all current running activities of the process. |
| 42 | + /// </summary> |
| 43 | + public static IEnumerable<IActivity> CurrentActivities(this IProcess process) |
| 44 | + { |
| 45 | + return process.GetActivities(activity => activity.Tracing?.Started != null && activity.Result == null); |
| 46 | + } |
| 47 | + |
24 | 48 | /// <summary> |
25 | 49 | /// Get last completed activity |
26 | 50 | /// </summary> |
|
0 commit comments