public void Dispose() { var source = _source; var target = _target; _source = null; _target = null; source?.Dispose(); target?.Dispose(); }
public static IPipeElement <TContext, TInputForNextStep, TReturn> DoNext <TContext, TInput, TInputForNextStep, TReturn>( this IPipeElement <TContext, TInput, TInputForNextStep> element, ISyncStepProvider <TContext, TInputForNextStep, TReturn> provider) where TContext : PipeContext { return(new Element <TContext, TInputForNextStep, TReturn>( element.Context, element.PreviousElements.Append(element), provider)); }
public static async Task CompleteWithAsync <TInput, TInputForNextStep>( this IPipeElement <TimerPipeContext, TInput, TInputForNextStep> element, IAsyncTimerStepProvider <TInputForNextStep?, bool> provider) { var finalStep = new FinalElement <TimerPipeContext, TInputForNextStep, bool>( element.Context, element.PreviousElements.Append(element), provider); await finalStep.CompletePipeAsync(); }
public static async Task <IActionResult> CompleteWithAsync <TInput, TInputForNextStep>( this IPipeElement <HttpPipeContext, TInput, TInputForNextStep> element, IAsyncHttpStepProvider <TInputForNextStep?, IActionResult> provider) { var finalStep = new FinalElement <HttpPipeContext, TInputForNextStep, IActionResult>( element.Context, element.PreviousElements.Append(element), provider); return(await finalStep.CompletePipeAsync()); }
public static async Task <TReturn> CompleteWithAsync <TInput, TInputForNextStep, TReturn>( this IPipeElement <PipeContext, TInput, TInputForNextStep> element, IAsyncActivityStepProvider <TInputForNextStep?, TReturn> provider) { var finalStep = new FinalElement <PipeContext, TInputForNextStep, TReturn>( element.Context, element.PreviousElements.Append(element), provider); return(await finalStep.CompletePipeAsync()); }
public virtual void Dispose() { var source = _source; var sinks = _sinks.ToArray(); _source = null; _sinks.Clear(); source?.Dispose(); sinks.ForEach(s => s.Dispose()); }
internal static async Task <TReturn> InternalCompleteWithAsync <TStepProvider, TContext, TInput, TInputForNextStep, TReturn>( this IPipeElement <TContext, TInput, TInputForNextStep> element) where TStepProvider : IAsyncStepProvider <TContext, TInputForNextStep, TReturn> where TContext : PipeContext { var finalStep = new FinalElement <TContext, TInputForNextStep, TReturn>( element.Context, element.PreviousElements.Append(element), element.Context.ServiceProvider.GetRequiredService <TStepProvider>()); return(await finalStep.CompletePipeAsync()); }
public static IPipeElement <TContext, TInputForNextStep, TReturn> DoNext <TContext, TInput, TInputForNextStep, TReturn>( this IPipeElement <TContext, TInput, TInputForNextStep> element, Func <TContext, TInputForNextStep, TReturn> inlineMethod) where TContext : PipeContext => element.DoNext(new SyncLambdaStepProvider <TContext, TInputForNextStep, TReturn>(inlineMethod));
public void Detach() { _source = null; _sinks.Clear(); }
public void SetSource(IPipeElement source) { _source = source; }
/// <summary> /// Grants given pipe to this achievement. /// </summary> /// <param name="pipe">The pipe to count achievement for.</param> public void Grant(IPipeElement pipe) { if (pipe != null) { /* get level service because achieved points are calculated on a per level basis. */ ILevelService levels = this.GetLevelService(); if (levels != null) { /* add pipe */ this.Pipes++; /* add points */ this.Points += levels.Current.GetAchievementPoints(this.Pipes, pipe.Type); } } }
/// <summary> /// Adds a pipe in queue. /// </summary> /// <param name="pipe">The pipe to add to queue.</param> public void Enqueue(IPipeElement pipe) { if (this.pipes.Count < this.capacity) { this.pipes.Enqueue(pipe); this.ExecuteCommand(PresentationCommands.PipeQueue.Enqueue, new PresentSquareParameter(pipe.Id, pipe.Type)); } }