mirror of
				https://github.com/nsnail/spectre.console.git
				synced 2025-10-31 09:09:25 +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:
		 Phil Scott
					Phil Scott
				
			
				
					committed by
					
						 Patrik Svensson
						Patrik Svensson
					
				
			
			
				
	
			
			
			 Patrik Svensson
						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