in src/Engines/BaseEngine.cs [864:897]
public async Task<ExecutionResult> ExecuteAndNotify(
string input,
ISymbol symbol,
IChannel channel,
Func<string, ISymbol, IChannel, Task<ExecutionResult>> action,
EventHandler<ExecutedEventArgs> evt
) => await ExecuteAndNotify(
input,
symbol,
channel,
CancellationToken.None,
(input, symbol, channel, cancellationToken) => action(input, symbol, channel),
evt
);
/// <summary>
/// Executes the given action with the corresponding parameters, and then triggers the given event.
/// </summary>
public async Task<ExecutionResult> ExecuteAndNotify(
string input,
ISymbol? symbol,
IChannel channel,
CancellationToken cancellationToken,
Func<string, ISymbol?, IChannel, CancellationToken, Task<ExecutionResult>> action,
EventHandler<ExecutedEventArgs> evt
)
{
var duration = Stopwatch.StartNew();
var result = await action(input, symbol, channel, cancellationToken);
duration.Stop();
evt?.Invoke(this, new ExecutedEventArgs(symbol, result, duration.Elapsed, this.ExecutionCount));
return result;
}