예제 #1
0
        /// <summary>
        /// Executes the task synchronously.
        /// This does not make use of a controller and therefore the <see cref="AppTask.ID"/>
        /// property will not get set.
        /// </summary>
        /// <param name="task">The task to run.</param>
        /// <param name="taskFolderPath">
        /// The folder path to use when running this task.
        /// If not specified, the <see cref="Environment.CurrentDirectory"/> will be used.
        /// </param>
        public static void ExecuteTaskInline(AppTask task, string taskFolderPath = null)
        {
            if (String.IsNullOrEmpty(taskFolderPath))
            {
                taskFolderPath = Environment.CurrentDirectory;
            }

            task.Setup(taskFolderPath);
            if (!task.IsComplete)    // i.e. has not completed with an error during setup.
            {
                task.RunSynchronously();
            }
        }
예제 #2
0
        private void SetupTask(AppTask task)
        {
            if (task.Status > AppTaskStatus.Waiting)
            {
                throw new InvalidOperationException("The task is already setup.");
            }


            // Setup the task
            string taskFolderPath = task.TaskFolderPath;

            if (String.IsNullOrEmpty(taskFolderPath))
            {
                taskFolderPath = Path.Combine(BaseFolderPath, String.Format(TaskFolderNameFormatString, task.ID));
            }

            task.Setup(taskFolderPath);
        }