forked from sim0n00ps/OF-DL
22 lines
481 B
C#
22 lines
481 B
C#
using OF_DL.Services;
|
|
|
|
namespace OF_DL.Gui.Services;
|
|
|
|
internal sealed class AvaloniaProgressReporter(
|
|
Action<long> reportAction,
|
|
Func<bool> isCancellationRequested) : IProgressReporter
|
|
{
|
|
public void ReportProgress(long increment)
|
|
{
|
|
if (isCancellationRequested())
|
|
{
|
|
throw new OperationCanceledException("Operation canceled by user.");
|
|
}
|
|
|
|
if (increment > 0)
|
|
{
|
|
reportAction(increment);
|
|
}
|
|
}
|
|
}
|