mirror of
https://github.com/spectreconsole/spectre.console.git
synced 2025-10-25 15:19:23 +00:00
Add IProgress<double> to ProgressTask.cs
Makes the Report method an explicit implementation to allow for better interoperability with standard .NET progress functionality while keeping backwards compatibility with existing ProgressTask functionality. Closes #285
This commit is contained in:
committed by
Patrik Svensson
parent
855127f32a
commit
da9c6ee4c2
@@ -7,7 +7,7 @@ namespace Spectre.Console
|
||||
/// <summary>
|
||||
/// Represents a progress task.
|
||||
/// </summary>
|
||||
public sealed class ProgressTask
|
||||
public sealed class ProgressTask : IProgress<double>
|
||||
{
|
||||
private readonly List<ProgressSample> _samples;
|
||||
private readonly object _lock;
|
||||
@@ -297,5 +297,11 @@ namespace Spectre.Console
|
||||
return TimeSpan.FromSeconds(estimate);
|
||||
}
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
void IProgress<double>.Report(double value)
|
||||
{
|
||||
Update(increment: value - Value);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user