Add events aggregator

This commit is contained in:
2025-11-16 16:52:06 +09:00
parent 7991c558cd
commit 6abff9cc7e
7 changed files with 49 additions and 32 deletions

View File

@ -0,0 +1,22 @@
using Hcs.WebApp.Data.Hcs;
namespace Hcs.WebApp.BackgroundServices
{
public class EventsAggregator
{
public event Action<Operation> OnOperationCreated;
public event OperationStarted OnOperationStarted;
public event OperationExecuted OnOperationExecuted;
public event OperationEnded OnOperationEnded;
public EventsAggregator(OperationExecutionState operationExecutionState, ResultGetState resultGetState)
{
operationExecutionState.OnOperationCreated += (a) => OnOperationCreated?.Invoke(a);
operationExecutionState.OnOperationStarted += (a, b, c) => OnOperationStarted?.Invoke(a, b, c);
operationExecutionState.OnOperationExecuted += (a, b, c) => OnOperationExecuted?.Invoke(a, b, c);
operationExecutionState.OnOperationEnded += (a, b, c, d) => OnOperationEnded?.Invoke(a, b, c, d);
resultGetState.OnOperationEnded += (a, b, c, d) => OnOperationEnded?.Invoke(a, b, c, d);
}
}
}