private void LoadSteps(IEnumerable<Step> srcSteps) { Steps = new List<Step>(); foreach (var step in srcSteps.Where(x => !x.Hidden)) { var stepType = step.StepType; Step dest; switch (stepType) { case FlowStepType.BranchingStep: dest = copyBranchingStep(step as BranchingStep); break; case FlowStepType.CreateObjectTask: dest = copyCreateObjectStep(step as CreateObjectStep); break; case FlowStepType.EndStep: dest = new EndStep(step as EndStep); break; case FlowStepType.GotoStep: dest = new GotoStep(step as GotoStep); break; case FlowStepType.ParalleizationStep: dest = new ParallelizationStep(step as ParallelizationStep); break; case FlowStepType.ParallelEndStep: dest = new ParallelEndStep(step as ParallelEndStep); break; case FlowStepType.RestoreStep: dest = new RestoreStep(step as RestoreStep); break; case FlowStepType.Stage: dest = copyStage(step as Stage); break; case FlowStepType.TaskStep: dest = copyTaskStep(step as TaskStep); break; case FlowStepType.WorkflowOwnerStep: dest = copyWorkflowOwnerStep(step as WorkflowOwnerStep); break; default: throw new Exception("Не удалось определить тип шага"); } dest.LoadOutputs(step.BaseOutputs); Steps.Add(dest); } foreach (var result in Steps.Where(x => x.BaseOutputs != null).SelectMany(x => x.BaseOutputs) .Join(Steps, o => o.NextStepViewID, i => i.ViewID, (o, i) => new { Output = o, NextStep = i })) { result.Output.NextStep = result.NextStep; } }
public GotoStep(GotoStep src) : base(src) { ReturnToStep = src.ReturnToStep; BaseOutputs = new List<Output>(); }