OF-DL/OF DL.Gui/Services/AvaloniaStatusReporter.cs

19 lines
424 B
C#

using OF_DL.Services;
namespace OF_DL.Gui.Services;
internal sealed class AvaloniaStatusReporter(
Action<string> statusAction,
Func<bool> isCancellationRequested) : IStatusReporter
{
public void ReportStatus(string message)
{
if (isCancellationRequested())
{
throw new OperationCanceledException("Operation canceled by user.");
}
statusAction(message);
}
}