Ejemplo n.º 1
0
        public IPromise Create(Action action, PromisePriority priority)
        {
            if (_disposed)
            {
                throw new ObjectDisposedException("PromiseFactory");
            }

            switch (priority)
            {
            case PromisePriority.Normal:
                return(new NormalPromise(this, _taskFactory, _taskFactory.Create(action)));

            case PromisePriority.Immediate:
                return(new NormalPromise(this, _taskFactory, _taskFactory.CreateImmediately(action)));

            default:
                return(new NormalPromise(this, _taskFactory, _taskFactory.Create(action, (int)priority)));
            }
        }