private void LoadAvailableTools( ) { this.AvailableTools = new ObservableCollection <string>( ); foreach (var category in TasksManager.Create( ).AvailableTools.OrderBy(c => c.ToString( ))) { this.AvailableTools.Add(category); } }
public TaskViewModel(ViewTemplate template, ITaskRepository repository) { _viewsManager = ViewsManager.Create(); _tasksManager = TasksManager.Create(); this.Repository = repository; this.ViewTemplate = template; this.LoadData(); this.ConfigureCommands(); this.ConfigureView(); }
private static void ExecuteTask(TaskInfo taskInfo) { var taskManager = TasksManager.Create(); ITool taskEngine = taskManager.CreateTaskEngineInstance(taskInfo.Category); taskInfo.Status = TaskStatus.Running; taskInfo.LastExecution = DateTime.Now; taskEngine.SetParameters(taskInfo.Parameters); var taskAsync = taskEngine.RunAsync(); taskAsync.ContinueWith((t) => { IMessages messages = (IMessages)t.Result; Logger.AddMessages(messages); taskInfo.Status = messages.HasErrors ? TaskStatus.Error : TaskStatus.Success; }, asyncTasks.TaskScheduler.FromCurrentSynchronizationContext()); }
private void ExecuteMergeTool(string sourcePath, string targetPath, bool recursive) { Logger.AddTrace("Executing Merge Tool"); var tasksManager = TasksManager.Create(); ITool taskEngine = tasksManager.CreateTaskEngineInstance("MergeFiles"); if (taskEngine == null) { Logger.AddWarning("Can't find MergeFiles tool."); return; } var parametersDefinition = taskEngine.GetParametersDefinition(); var parameters = new Parameters(); foreach (var param in parametersDefinition) { switch (param.Key) { case "Path1": parameters.Add(new Parameter() { Key = "Path1", Value = sourcePath }); break; case "Path2": parameters.Add(new Parameter() { Key = "Path2", Value = targetPath }); break; case "Recursive": parameters.Add(new Parameter() { Key = "Recursive", Value = recursive.ToString() }); break; case "ExcludeFileSpecs": parameters.Add(new Parameter() { Key = "ExcludeFileSpecs", Value = string.Empty }); break; default: Logger.AddWarning(string.Format("The parameter {0} doesn't exists in the MergeFiles tool.", param.Key)); break; } } if (parameters.Items.Count != parametersDefinition.Count()) { return; } taskEngine.SetParameters(parameters); taskEngine.Run(); }