public static void Delay([NotNull] this IWaitHandler waitHandler, TimeSpan delay, CancellationToken cancellationToken = default(CancellationToken)) { if (waitHandler == null) { throw new ArgumentNullException(nameof(waitHandler)); } var clock = new Clock(); var scope = new Scope().Enter(); clock.TickInterval = delay; clock.TickAction = () => { scope.Leave(); clock.IsEnabled = false; }; clock.IsEnabled = true; waitHandler.Wait(() => !scope.IsInScope, cancellationToken); }
public override void StateBegin() { ctrl.Wait(); queueController.isSkipLine = false; ctrl.onResume += OnResume; }