LatestOperation
StockSharp.Xaml
Runs what a control starts from a place that cannot wait for it - a property setter, say - one run at a time: starting the next run abandons the one in flight, and a failure is handed to the owner.
实现: IDisposable
构造函数
LatestOperation
public LatestOperation(Action<Exception> failed)
latestOperation = LatestOperation(failed)
Initializes a new instance of the LatestOperation class.
- failed
- Receives what a run failed with. An abandoned run is not a failure.
属性
Completion
public Task Completion { get; }
value = latestOperation.Completion
The run started last. It completes when that run has finished, failed or been abandoned, and never faults.
方法
Abandon
public void Abandon()
latestOperation.Abandon()
Abandons the run in flight without starting another one.
Dispose
public void Dispose()
latestOperation.Dispose()
Disposes of items in the pool that implement IDisposable.
Start
public void Start(Func<CancellationToken, Task> operation)
latestOperation.Start(operation)
Abandons the run in flight and starts .
- operation
- The run. Its token is cancelled when a later run replaces it.