##// END OF EJS Templates
Добавлена метка v3.0.6 для набора изменений 547a2fc0d93e
Добавлена метка v3.0.6 для набора изменений 547a2fc0d93e

File last commit:

r260:547a2fc0d93e v3.0.6 v3
r261:05a87f575512 v3
Show More
MockPollComponent.cs
34 lines | 983 B | text/x-csharp | CSharpLexer
using System;
using System.Threading;
using System.Threading.Tasks;
using Implab.Components;
namespace Implab.Test {
public class MockPollComponent : PollingComponent {
public Func<CancellationToken,Task> PollWorker { get; set;}
public Func<CancellationToken, Task> StartWorker { get; set; }
public Func<CancellationToken, Task> StopWorker { get; set; }
public MockPollComponent(bool initialized) : base(initialized) {
}
protected async override Task Poll(CancellationToken ct) {
if(PollWorker!= null)
await PollWorker.Invoke(ct);
}
protected async override Task StopInternalAsync(CancellationToken ct) {
if (StopWorker != null)
await StopWorker.Invoke(ct);
}
protected async override Task StartInternalAsync(CancellationToken ct) {
if (StartWorker != null)
await StartWorker.Invoke(ct);
}
}
}