/// <summary> /// Adds an additional rendering step to <see cref="Steps"/>. /// </summary> /// <param name="anchorId">Id of the existing rendering step to which the new step will be anchored.</param> /// <param name="anchorPos">Position of the new rendering step relative to the one it is anchored to.</param> /// <param name="step">The new rendering step that should be inserted into the rendering step sequence.</param> public void AddRenderStep(string anchorId, RenderStepPosition anchorPos, RenderStep step) { int anchorIndex = -1; switch (anchorPos) { case RenderStepPosition.Before: anchorIndex = this.steps.FindIndex(existingStep => existingStep.Id == anchorId); if (anchorIndex == -1) { anchorIndex = 0; } break; case RenderStepPosition.After: anchorIndex = this.steps.FindIndex(existingStep => existingStep.Id == anchorId); if (anchorIndex == -1) { anchorIndex = this.steps.Count; } else { anchorIndex++; } break; case RenderStepPosition.First: anchorIndex = 0; break; case RenderStepPosition.Last: anchorIndex = this.steps.Count; break; } if (anchorIndex != -1) { this.steps.Insert(anchorIndex, step); } }
/// <summary> /// Adds an additional rendering step to <see cref="Steps"/>. /// </summary> /// <param name="anchorPos">Position of the new rendering step relative to the one it is anchored to.</param> /// <param name="step">The new rendering step that should be inserted into the rendering step sequence.</param> public void AddRenderStep(RenderStepPosition anchorPos, RenderStep step) { this.AddRenderStep(null, anchorPos, step); }