using System;
namespace QFSW.QC.Actions
{
///
/// Custom action implemented via delegates.
/// For more complex actions it is usually recommended to create a new action implementing ICommandAction.
///
public class Custom : ICommandAction
{
private readonly Func _isFinished;
private readonly Func _startsIdle;
private readonly Action _start;
private readonly Action _finalize;
public Custom(
Func isFinished,
Func startsIdle,
Action start,
Action finalize
)
{
_isFinished = isFinished;
_startsIdle = startsIdle;
_start = start;
_finalize = finalize;
}
public bool IsFinished => _isFinished();
public bool StartsIdle => _startsIdle();
public void Start(ActionContext context) { _start(context); }
public void Finalize(ActionContext context) { _finalize(context); }
}
}