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); } } }
public RunningTaskInformation( TaskRunnerCommandContext context, TaskRunnerWithOptions task) { Context = context; Task = task; }
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); } }