mirror of
https://github.com/nsnail/spectre.console.git
synced 2025-04-16 17:02:51 +08: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:
parent
855127f32a
commit
da9c6ee4c2
@ -7,7 +7,7 @@ namespace Spectre.Console
|
|||||||
/// <summary>
|
/// <summary>
|
||||||
/// Represents a progress task.
|
/// Represents a progress task.
|
||||||
/// </summary>
|
/// </summary>
|
||||||
public sealed class ProgressTask
|
public sealed class ProgressTask : IProgress<double>
|
||||||
{
|
{
|
||||||
private readonly List<ProgressSample> _samples;
|
private readonly List<ProgressSample> _samples;
|
||||||
private readonly object _lock;
|
private readonly object _lock;
|
||||||
@ -297,5 +297,11 @@ namespace Spectre.Console
|
|||||||
return TimeSpan.FromSeconds(estimate);
|
return TimeSpan.FromSeconds(estimate);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// <inheritdoc />
|
||||||
|
void IProgress<double>.Report(double value)
|
||||||
|
{
|
||||||
|
Update(increment: value - Value);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Loading…
x
Reference in New Issue
Block a user