/// <summary> /// Creates a new <see cref="ReactionPipelineStage"/> with the specified name and reaction to the specified inputs. /// </summary> /// <param name="name">The name of the new reaction.</param> /// <param name="reaction">The reaction delegate.</param> /// <param name="input1">Input number 1.</param> /// <param name="input2">Input number 2.</param> /// <param name="input3">Input number 3.</param> /// <param name="input4">Input number 4.</param> /// <param name="input5">Input number 5.</param> /// <param name="input6">Input number 6.</param> /// <param name="input7">Input number 7.</param> /// <param name="reactImmediately">Denotes if the reaction should fire immediately upon construction.</param> public ReactionPipelineStage( string name, Action <TInput1, TInput2, TInput3, TInput4, TInput5, TInput6, TInput7> reaction, IPipelineStage <TInput1> input1, IPipelineStage <TInput2> input2, IPipelineStage <TInput3> input3, IPipelineStage <TInput4> input4, IPipelineStage <TInput5> input5, IPipelineStage <TInput6> input6, IPipelineStage <TInput7> input7, bool reactImmediately) { Name = name ?? throw new ArgumentNullException(nameof(name)); Reaction = reaction ?? throw new ArgumentNullException(nameof(reaction)); Input1 = input1 ?? throw new ArgumentNullException(nameof(input1)); Input2 = input2 ?? throw new ArgumentNullException(nameof(input2)); Input3 = input3 ?? throw new ArgumentNullException(nameof(input3)); Input4 = input4 ?? throw new ArgumentNullException(nameof(input4)); Input5 = input5 ?? throw new ArgumentNullException(nameof(input5)); Input6 = input6 ?? throw new ArgumentNullException(nameof(input6)); Input7 = input7 ?? throw new ArgumentNullException(nameof(input7)); this.AddDependencies(input1, input2, input3, input4, input5, input6, input7); if (reactImmediately) { Reaction(Input1.GetValue(), Input2.GetValue(), Input3.GetValue(), Input4.GetValue(), Input5.GetValue(), Input6.GetValue(), Input7.GetValue()); } }
/// <summary> /// Handles invalidation of the operation stage, and reacts as appropriate. /// </summary> /// <param name="invalidator">The invalidator.</param> public void OnInvalidate(IPipelineInvalidator invalidator) { invalidator.InvalidateAllDependentStages(this); Reaction(Input1.GetValue(), Input2.GetValue(), Input3.GetValue(), Input4.GetValue(), Input5.GetValue(), Input6.GetValue(), Input7.GetValue()); }
public DispatcherReactionPipelineStage( string name, Action <TInput1, TInput2, TInput3, TInput4, TInput5> reaction, Dispatcher dispatcher, IPipelineStage <TInput1> input1, IPipelineStage <TInput2> input2, IPipelineStage <TInput3> input3, IPipelineStage <TInput4> input4, IPipelineStage <TInput5> input5, bool reactImmediately) { Name = name ?? throw new ArgumentNullException(nameof(name)); Reaction = reaction ?? throw new ArgumentNullException(nameof(reaction)); Dispatcher = dispatcher ?? throw new ArgumentNullException(nameof(dispatcher)); Input1 = input1 ?? throw new ArgumentNullException(nameof(input1)); Input2 = input2 ?? throw new ArgumentNullException(nameof(input2)); Input3 = input3 ?? throw new ArgumentNullException(nameof(input3)); Input4 = input4 ?? throw new ArgumentNullException(nameof(input4)); Input5 = input5 ?? throw new ArgumentNullException(nameof(input5)); this.AddDependencies(input1, input2, input3, input4, input5); if (reactImmediately) { InvokeReaction(Input1.GetValue(), Input2.GetValue(), Input3.GetValue(), Input4.GetValue(), Input5.GetValue()); } }