void CreateCheckForUpdatesTask(CheckForUpdatesTask checkForUpdatesTask)
        {
            currentCheckForUpdatesTask = checkForUpdatesTask;

            task = taskFactory.CreateTask(
                () => CheckForUpdates(checkForUpdatesTask),
                OnCheckForUpdatesCompleted);
        }
Ejemplo n.º 2
0
        void CreateCheckForUpdatesTask(CheckForUpdatesTask checkForUpdatesTask)
        {
            currentCheckForUpdatesTask          = checkForUpdatesTask;
            checkForUpdatesTask.ProgressMonitor = CreateProgressMonitor();

            task = taskFactory.CreateTask(
                () => CheckForUpdates(checkForUpdatesTask),
                OnCheckForUpdatesCompleted);
        }
Ejemplo n.º 3
0
        void CreateReadPackagesTask()
        {
            var query = new PackagesForSelectedPageQuery2(this, allPackages, GetSearchCriteria());

            packagesForSelectedPageQuery = query;

            task = taskFactory.CreateTask(
                () => GetPackagesForSelectedPageResult(query),
                OnPackagesReadForSelectedPage);
        }
Ejemplo n.º 4
0
        public TaskResult RunTask(string taskId)
        {
            try
            {
                logger.InfoFormat("Running task: '{0}'", taskId);

                ITaskConfig taskConfig = predefinedTasksConfig.GetTaskConfig(taskId);
                return(taskFactory.CreateTask(taskConfig).Run());
            }
            catch (Exception ex)
            {
                var message = string.Format("Running task '{0}' failed.", taskId);
                logger.Info(message, ex);
                return(TaskResult.Failed(message));
            }
        }
Ejemplo n.º 5
0
 public void RunDelegatedTask(string delegationId, string taskDefinition)
 {
     logger.DebugFormat("Received delegated task: '{0}'", taskDefinition);
     new Task(() =>
     {
         try
         {
             var task = taskFactory.CreateTask(new TaskConfig(new ConfigReader(JToken.Parse(taskDefinition))));
             masterClient.TaskFinished(delegationId, task.Run());
         }
         catch (Exception ex)
         {
             logger.Error(string.Format("Exception during execution of delagated task: '{0}'", delegationId), ex);
             masterClient.TaskFinished(delegationId, TaskResult.Failed(ex.Message));
         }
     }).Start();
 }
Ejemplo n.º 6
0
        protected override TaskResult DoTask()
        {
            var taskConfigs = config.TaskConfigs.ToList();

            if (!taskConfigs.Any())
            {
                logger.InfoFormat("No tasks to run.");
            }

            logger.InfoFormat("Runnig task list: {0}",
                              string.Join("", taskConfigs.Select(t => Environment.NewLine + " - " + t.GetTaskInfo())));

            var results = new List <TaskResult>();

            taskConfigs.ForEach(tc =>
            {
                var taskInfo = tc.GetTaskInfo();

                logger.DebugFormat("Creating task: {0}", taskInfo);
                var task = taskFactory.CreateTask(tc);

                logger.DebugFormat("Runnig: {0}", taskInfo);
                results.Add(task.Run());
            });

            logger.DebugFormat("Finished.");

            var description = string.Join(Environment.NewLine, results.Select(r => r.Description).Where(s => !string.IsNullOrWhiteSpace(s)));

            if (results.All(r => r.Status == TaskResultStatus.Success))
            {
                return(TaskResult.Success(description));
            }

            if (results.Any(r => r.Status == TaskResultStatus.Failed))
            {
                return(TaskResult.Failed(description));
            }

            return(TaskResult.Warning(description));
        }
Ejemplo n.º 7
0
    public void CreateAwnFileTask()
    {
        var task = _tasksFactory.CreateTask <AWNFileGeneratorTask>();

        _tasksList.Add(task);
    }
 void CreateReadPackagesTask()
 {
     task = taskFactory.CreateTask(
         () => GetPackagesForSelectedPageResult(),
         (result) => OnPackagesReadForSelectedPage(result));
 }