Ejemplo n.º 1
0
        /// <inheritdoc />
        public IScheduledBackgroundTask Schedule(IBackgroundTask task, TimeSpan delay)
        {
            this._tasks ??= new List <ScheduledBackgroundTask>();

            var envelope      = this.CreateTaskEnvelope(task);
            var scheduledTask = new ScheduledBackgroundTask(envelope, delay, this);

            this._tasks.Add(scheduledTask);

            return(scheduledTask);
        }
Ejemplo n.º 2
0
        /// <inheritdoc />
        public IScheduledBackgroundTask Enqueue(IBackgroundTask task)
        {
            this._tasks ??= new List <ScheduledBackgroundTask>();

            var envelope      = this.CreateTaskEnvelope(task);
            var scheduledTask = new ScheduledBackgroundTask(envelope, null, this);

            this._tasks.Add(scheduledTask);

            return(scheduledTask);
        }