38 lines
1.2 KiB
C#
38 lines
1.2 KiB
C#
using System;
|
|
using System.Threading.Tasks;
|
|
using MW.WorkFlow;
|
|
using MainShell.Common;
|
|
|
|
namespace MainShell.Process
|
|
{
|
|
public class SubstrateLoadActivity : ActivityAbstractBase
|
|
{
|
|
public SubstrateLoadActivity(string name) : base(name)
|
|
{
|
|
|
|
}
|
|
|
|
protected override async Task<ActivityResult> OnExecuteAsync(WorkflowContext context, ActivityControl activityControl)
|
|
{
|
|
for (var i = 0; i < 10; i++)
|
|
{
|
|
activityControl.ThrowIfCancellationRequested();
|
|
await activityControl.CheckPauseAsync();
|
|
await Task.Delay(100, activityControl.CancellationToken);
|
|
}
|
|
|
|
context.SetData(WorkflowContextKeys.SubstrateProcessState, SubstrateLifecycleState.Loaded);
|
|
|
|
return ActivityResult.Success;
|
|
}
|
|
protected override void PrepareExecute(WorkflowContext context, ActivityControl activityControl)
|
|
{
|
|
// Custom preparation logic before execution
|
|
}
|
|
protected override void AfterExecute(WorkflowContext context, ActivityControl activityControl)
|
|
{
|
|
// Custom cleanup logic after execution
|
|
}
|
|
}
|
|
}
|