/// <summary> /// Procesa un bloque de pasos /// </summary> private async Task ProcessBlockAsync(ProcessBlockModel block) { System.Collections.Generic.List <Task> stepTasks = new System.Collections.Generic.List <Task>(); // Añade los procesos de ejecución foreach (ProcessStepModel step in block.Steps) { stepTasks.Add(ProcessStepAsync(step)); } // Espera a que se ejecuten todas las tareas await Task.WhenAll(stepTasks); }
/// <summary> /// Carga los datos de un bloque /// </summary> private ProcessBaseModel LoadBlock(JobModel job, MLNode rootML) { ProcessBlockModel block = new ProcessBlockModel(job); // Asigna las propiedades básicas block.StartWithPreviousError = rootML.Attributes[TagStartWithPreviousError].Value.GetBool(false); block.Name = rootML.Nodes[TagName].Value; block.Description = rootML.Nodes[TagDescription].Value; // Carga los datos foreach (MLNode nodeML in rootML.Nodes) { switch (nodeML.Name) { case TagStep: block.Steps.Add(LoadStep(job, nodeML)); break; } } // Devuelve los datos del bloque return(block); }