Пример #1
0
 public QueueItem(TKey key, TInput input, QueueTransformAsync queueTransformAsync)
 {
     Key   = key;
     Input = input;
     QueueTransformAsync  = queueTransformAsync;
     TaskCompletionSource = new TaskCompletionSource <TOutput>();
 }
Пример #2
0
        public Task <TOutput> EnqueueTransform(TKey key, TInput input, QueueTransformAsync transformAsync)
        {
            foreach (var anItem in Queue)
            {
                if (anItem.Key.Equals(key))
                {
                    Log.Info($"Task with key {key} already present");
                    return(anItem.TaskCompletionSource.Task);
                }
            }

            var item = new QueueItem(key, input, transformAsync);

            Queue.Add(item);

            QueueChanged?.Invoke(this, new TransformQueueEventArgs(Queue.Count));

            return(item.TaskCompletionSource.Task);
        }