예제 #1
0
        public async Task <ITaskRunnerCommandResult> RunTaskAsync(TaskRunnerWithOptions task, bool clearConsole = true)
        {
            Runtime.AssertMainThread();

            RunningTaskInformation runningTask = null;

            try {
                Xwt.NotebookTab       tab             = widget.GetTaskOutputTab(task.TaskRunner.Name);
                OutputProgressMonitor progressMonitor = widget.GetProgressMonitor(tab, clearConsole);

                task.ApplyOptionsToCommand();

                var context = new TaskRunnerCommandContext(progressMonitor);
                runningTask = new RunningTaskInformation(context, task);
                TaskRunnerServices.Workspace.AddRunningTask(runningTask);

                widget.OpenTaskOutputTab(tab, runningTask);

                var result = await task.TaskRunner.Invoke(context);

                widget.ShowResult(tab, result);
                return(result);
            } finally {
                if (runningTask != null)
                {
                    TaskRunnerServices.Workspace.RemoveRunningTask(runningTask);
                    widget.HideRunningStatus(runningTask);
                }
            }
        }
예제 #2
0
 public RunningTaskInformation(
     TaskRunnerCommandContext context,
     TaskRunnerWithOptions task)
 {
     Context = context;
     Task    = task;
 }
예제 #3
0
 void RunTask(ITaskRunnerNode taskRunnerNode, IEnumerable <ITaskRunnerOption> options)
 {
     try {
         var task = new TaskRunnerWithOptions(taskRunnerNode, options);
         RunTaskAsync(task).Ignore();
     } catch (Exception ex) {
         LoggingService.LogError("TaskRunnerExplorerPad.RunTask error", ex);
     }
 }