Esempio n. 1
0
        public static Task <bool> WaitForEventAsync <TSource>([NotNull] WaitForEventSettings <TSource> settings, CancellationToken token = default(CancellationToken))
        {
            // Short-circuit: already cancelled
            if (token.IsCancellationRequested)
            {
                return(Task.FromResult(false));
            }
            // WARNING: DO NOT DISPOSE THIS
            EventWatcher <TSource> watcher = EventWatcher.Create(settings);

            return(watcher.WaitAsync(settings.Timeout.TotalIntMilliseconds(), token));
        }