Ejemplo n.º 1
0
        public void Start(IBackgroundTaskInstance taskInstance)
        {
            var task = BackgroundTasks.FirstOrDefault(b => b.Match(taskInstance?.Task?.Name));

            if (task == null)
            {
                // This condition should not be met. It is it it means the background task to start was not found in the background tasks managed by this service.
                // Please check CreateInstances to see if the background task was properly added to the BackgroundTasks property.
                return;
            }

            task.RunAsync(taskInstance).FireAndForget();
        }
        public void TriggerBackTask(string taskName)
        {
            var task = BackgroundTasks.FirstOrDefault(b => b.Match(taskName));

            task?.Trigger();
        }
        public void StopBackTask(string taskName)
        {
            var task = BackgroundTasks.FirstOrDefault(b => b.Match(taskName));

            task?.Kill();
        }