Rename SubmitActivity to PostActivity
This commit is contained in:
parent
f9a7ee45f1
commit
ceed1ff1fe
|
|
@ -66,7 +66,7 @@ public class For : Activity
|
|||
|
||||
if (loop)
|
||||
{
|
||||
context.SubmitActivity(iterateNode, OnChildComplete);
|
||||
context.PostActivity(iterateNode, OnChildComplete);
|
||||
|
||||
// Update loop variable.
|
||||
CurrentValue.Set(context.ExpressionExecutionContext, currentValue);
|
||||
|
|
|
|||
|
|
@ -32,7 +32,7 @@ public class ForEach : Activity
|
|||
CurrentValue.Set(context, currentItem);
|
||||
|
||||
if (Body != null)
|
||||
context.SubmitActivity(Body, OnChildCompleted);
|
||||
context.PostActivity(Body, OnChildCompleted);
|
||||
|
||||
// Increment index.
|
||||
context.UpdateProperty<int>(CurrentIndexProperty, x => x + 1);
|
||||
|
|
|
|||
|
|
@ -11,7 +11,7 @@ public class Fork : Activity
|
|||
[Input] public Input<JoinMode> JoinMode { get; set; } = new(ControlFlow.JoinMode.WaitAny);
|
||||
[Outbound] public ICollection<IActivity> Branches { get; set; } = new List<IActivity>();
|
||||
|
||||
protected override void Execute(ActivityExecutionContext context) => context.ScheduleActivities(Branches.Reverse(), CompleteChildAsync);
|
||||
protected override void Execute(ActivityExecutionContext context) => context.PostActivities(Branches.Reverse(), CompleteChildAsync);
|
||||
|
||||
private ValueTask CompleteChildAsync(ActivityExecutionContext context, ActivityExecutionContext childContext)
|
||||
{
|
||||
|
|
|
|||
|
|
@ -24,7 +24,7 @@ public class If : Activity
|
|||
var nextNode = result ? Then : Else;
|
||||
|
||||
if (nextNode != null)
|
||||
context.SubmitActivity(nextNode, OnChildCompletedAsync);
|
||||
context.PostActivity(nextNode, OnChildCompletedAsync);
|
||||
}
|
||||
|
||||
private ValueTask OnChildCompletedAsync(ActivityExecutionContext context, ActivityExecutionContext childContext)
|
||||
|
|
|
|||
|
|
@ -26,7 +26,7 @@ public class ParallelForEach<T> : Activity
|
|||
};
|
||||
|
||||
// Schedule a body of work for each item.
|
||||
context.SubmitActivity(Body, OnChildCompleted, new[]{localVariable});
|
||||
context.PostActivity(Body, OnChildCompleted, new[]{localVariable});
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -21,12 +21,12 @@ public class Switch : Activity
|
|||
if (matchingCase != null)
|
||||
{
|
||||
if (matchingCase.Activity != null)
|
||||
context.SubmitActivity(matchingCase.Activity);
|
||||
context.PostActivity(matchingCase.Activity);
|
||||
return;
|
||||
}
|
||||
|
||||
if (Default != null)
|
||||
context.SubmitActivity(Default);
|
||||
context.PostActivity(Default);
|
||||
}
|
||||
|
||||
private async Task<SwitchCase?> FindMatchingCaseAsync(ExpressionExecutionContext context)
|
||||
|
|
|
|||
|
|
@ -39,7 +39,7 @@ public class While : Activity
|
|||
var loop = context.Get(Condition);
|
||||
|
||||
if (loop)
|
||||
context.SubmitActivity(Body, OnBodyCompleted);
|
||||
context.PostActivity(Body, OnBodyCompleted);
|
||||
}
|
||||
|
||||
private async ValueTask OnBodyCompleted(ActivityExecutionContext context, ActivityExecutionContext childContext)
|
||||
|
|
@ -47,6 +47,6 @@ public class While : Activity
|
|||
var loop = await context.EvaluateAsync(Condition);
|
||||
|
||||
if (loop)
|
||||
context.SubmitActivity(Body, OnBodyCompleted);
|
||||
context.PostActivity(Body, OnBodyCompleted);
|
||||
}
|
||||
}
|
||||
|
|
@ -18,7 +18,7 @@ public class Composite : Activity
|
|||
|
||||
protected override void Execute(ActivityExecutionContext context)
|
||||
{
|
||||
context.SubmitActivity(Root, OnCompletedAsync);
|
||||
context.PostActivity(Root, OnCompletedAsync);
|
||||
}
|
||||
|
||||
protected virtual ValueTask OnCompletedAsync(ActivityExecutionContext context, ActivityExecutionContext childContext) => ValueTask.CompletedTask;
|
||||
|
|
@ -46,7 +46,7 @@ public class Composite<T> : Activity<T>
|
|||
|
||||
protected override void Execute(ActivityExecutionContext context)
|
||||
{
|
||||
context.SubmitActivity(Root, OnCompletedAsync);
|
||||
context.PostActivity(Root, OnCompletedAsync);
|
||||
}
|
||||
|
||||
protected virtual ValueTask OnCompletedAsync(ActivityExecutionContext context, ActivityExecutionContext childContext) => ValueTask.CompletedTask;
|
||||
|
|
|
|||
|
|
@ -16,7 +16,7 @@ public class Flowchart : Container
|
|||
if (Start == null!)
|
||||
return;
|
||||
|
||||
context.SubmitActivity(Start, OnChildCompleted);
|
||||
context.PostActivity(Start, OnChildCompleted);
|
||||
}
|
||||
|
||||
private ValueTask OnChildCompleted(ActivityExecutionContext context, ActivityExecutionContext childContext)
|
||||
|
|
@ -33,6 +33,6 @@ public class Flowchart : Container
|
|||
var outboundConnections = Connections.Where(x => x.Source == parent).ToList();
|
||||
var children = outboundConnections.Select(x => x.Target).ToList();
|
||||
|
||||
context.ScheduleActivities(children, OnChildCompleted);
|
||||
context.PostActivities(children, OnChildCompleted);
|
||||
}
|
||||
}
|
||||
|
|
@ -35,7 +35,7 @@ public class Sequence : Container
|
|||
return;
|
||||
|
||||
var nextActivity = childActivities.ElementAt(currentIndex);
|
||||
context.SubmitActivity(nextActivity, OnChildCompleted);
|
||||
context.PostActivity(nextActivity, OnChildCompleted);
|
||||
context.UpdateProperty<int>(CurrentIndexProperty, x => x + 1);
|
||||
}
|
||||
|
||||
|
|
|
|||
|
|
@ -68,7 +68,7 @@ public class ActivityExecutionContext
|
|||
/// </summary>
|
||||
public IDictionary<string, object?> JournalData { get; private set; } = new Dictionary<string, object?>();
|
||||
|
||||
public void SubmitActivity(IActivity? activity, ActivityCompletionCallback? completionCallback = default, IEnumerable<RegisterLocationReference>? locationReferences = default, object? tag = default)
|
||||
public void PostActivity(IActivity? activity, ActivityCompletionCallback? completionCallback = default, IEnumerable<RegisterLocationReference>? locationReferences = default, object? tag = default)
|
||||
{
|
||||
if (activity == null)
|
||||
return;
|
||||
|
|
@ -76,7 +76,7 @@ public class ActivityExecutionContext
|
|||
WorkflowExecutionContext.Schedule(activity, this, completionCallback, locationReferences, tag);
|
||||
}
|
||||
|
||||
public void SubmitActivity(IActivity? activity, ActivityExecutionContext owner, ActivityCompletionCallback? completionCallback = default, IEnumerable<RegisterLocationReference>? locationReferences = default, object? tag = default)
|
||||
public void PostActivity(IActivity? activity, ActivityExecutionContext owner, ActivityCompletionCallback? completionCallback = default, IEnumerable<RegisterLocationReference>? locationReferences = default, object? tag = default)
|
||||
{
|
||||
if (activity == null)
|
||||
return;
|
||||
|
|
@ -84,12 +84,12 @@ public class ActivityExecutionContext
|
|||
WorkflowExecutionContext.Schedule(activity, owner, completionCallback, locationReferences, tag);
|
||||
}
|
||||
|
||||
public void ScheduleActivities(params IActivity?[] activities) => ScheduleActivities((IEnumerable<IActivity?>)activities);
|
||||
public void PostActivities(params IActivity?[] activities) => PostActivities((IEnumerable<IActivity?>)activities);
|
||||
|
||||
public void ScheduleActivities(IEnumerable<IActivity?> activities, ActivityCompletionCallback? completionCallback = default)
|
||||
public void PostActivities(IEnumerable<IActivity?> activities, ActivityCompletionCallback? completionCallback = default)
|
||||
{
|
||||
foreach (var activity in activities)
|
||||
SubmitActivity(activity, completionCallback);
|
||||
PostActivity(activity, completionCallback);
|
||||
}
|
||||
|
||||
public void CreateBookmarks(IEnumerable<object> bookmarkData, ExecuteActivityDelegate? callback = default)
|
||||
|
|
|
|||
Loading…
Reference in a new issue