/// <summary> /// Execute the pipeline of the specified project. /// </summary> /// <param name="project">Project.</param> /// <returns>True if started, otherwise false<returns> public bool Execute(Project project) { if (nodes.Count == 0) { return false; } cancelRequest = new CancellationTokenSource(); CancellationToken token = cancelRequest.Token; project.NotifyPipelineStart(this); foreach (PipelineNode pNode in nodes) { foreach(Tuple<IType[], Result[]> results in pNode.results) { foreach (IType result in results.Item1) { result.Dispose(); } } pNode.results.Clear(); pNode.ClearInputQueue(); } PipelineProcessor process = new PipelineProcessor(project, token); Task executionTask = Task.Factory.StartNew(() => { foreach (PipelineNode pNode in nodes) { if (token.IsCancellationRequested) { break; } if (pNode.IsReady() && pNode.algorithm.Input.Count == 0) { bool isConnected = false; foreach (MarkerNode mNode in pNode.MNodes) { if (mNode.Edges.Count > 0) { isConnected = true; } } if (isConnected) { Result[] zeroInput = new Result[0]; process.Start(pNode, zeroInput, int.MaxValue); } } } }).ContinueWith(fromTask => { Application.Invoke(() => project.NotifyPipelineStop(this)); }); return true; }