public void Link(BlockBase target, bool propagare, Predicate <DataFlowToken> prediate = null) { var options = new DataflowLinkOptions { PropagateCompletion = propagare }; if (prediate != null) { this.Output.LinkTo(target.EntryPoint, options, prediate); return; } this.Output.LinkTo(target.EntryPoint, options); }
public static BlockLink Link(BlockBase source, BlockBase target, ICondition condition = null) { if (source == null || target == null) { throw new ArgumentNullException(); } if (source == target) { throw new ArgumentException("Cant link block to itself"); } var link = new BlockLink(source, target, condition); source.AddLink(link); target.AddLink(link); return(link); }
public void Visit(BlockBase block) { if (block.IncommingLinks.Count() <= 1) { return; } Task.WhenAll(block.IncommingLinks.Select(o => o.Source.Completion)) .ContinueWith(o => { // if any faults - cancel all data if (o.IsFaulted) { block.Fault(o.Exception); this._cancellationTokenSource.Cancel(); } else { block.Complete(); } }); }
private BlockLink(BlockBase source, BlockBase target, ICondition condition) { this.Source = source; this.Target = target; this.Condition = condition; }