Beispiel #1
0
        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);
        }
Beispiel #2
0
 public override void StateBegin()
 {
     ctrl.Wait();
     queueController.isSkipLine = false;
     ctrl.onResume += OnResume;
 }