Пример #1
0
 /// <summary>
 /// Attaches a new render hook onto the pipeline.
 /// </summary>
 /// <param name="hook">The render hook to attach.</param>
 public void Attach(IRenderHook hook)
 {
     lock (_lock)
     {
         _hooks.Add(hook);
     }
 }
Пример #2
0
 /// <summary>
 /// Detaches a render hook from the pipeline.
 /// </summary>
 /// <param name="hook">The render hook to detach.</param>
 public void Detach(IRenderHook hook)
 {
     lock (_lock)
     {
         _hooks.Remove(hook);
     }
 }
Пример #3
0
    /// <summary>
    /// Initializes a new instance of the <see cref="RenderHookScope"/> class.
    /// </summary>
    /// <param name="console">The console to attach the render hook to.</param>
    /// <param name="hook">The render hook.</param>
    public RenderHookScope(IAnsiConsole console, IRenderHook hook)
    {
        _console = console ?? throw new ArgumentNullException(nameof(console));
        _hook    = hook ?? throw new ArgumentNullException(nameof(hook));

        _console.Pipeline.Attach(_hook);
    }