Table of Contents

Class ThreadSafeConsoleManager

Namespace
CLI.CliniCore.Service
Assembly
CLI.CliniCore.dll

Thread-safe singleton for managing console operations. Prevents race conditions between main UI thread and background threads (like resize listener).

public sealed class ThreadSafeConsoleManager : IDisposable
Inheritance
ThreadSafeConsoleManager
Implements
Inherited Members

Properties

CurrentMode

public ThreadSafeConsoleManager.ConsoleMode CurrentMode { get; }

Property Value

ThreadSafeConsoleManager.ConsoleMode

Instance

public static ThreadSafeConsoleManager Instance { get; }

Property Value

ThreadSafeConsoleManager

IsInputRedirected

public bool IsInputRedirected { get; }

Property Value

bool

Methods

Clear()

public void Clear()

Dispose()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

public void Dispose()

GetCursorPosition()

public (int Left, int Top) GetCursorPosition()

Returns

(int Width, int Height)

GetDimensions()

public (int Width, int Height) GetDimensions()

Returns

(int Width, int Height)

GetDimensionsForceRefresh()

public (int Width, int Height) GetDimensionsForceRefresh()

Returns

(int Width, int Height)

ReadKey(bool)

public ConsoleKeyInfo ReadKey(bool intercept = false)

Parameters

intercept bool

Returns

ConsoleKeyInfo

ReadLine()

public string? ReadLine()

Returns

string

ResetColor()

public void ResetColor()

SetBackgroundColor(ConsoleColor)

public void SetBackgroundColor(ConsoleColor color)

Parameters

color ConsoleColor

SetCursorPosition(int, int)

public void SetCursorPosition(int left, int top)

Parameters

left int
top int

SetForegroundColor(ConsoleColor)

public void SetForegroundColor(ConsoleColor color)

Parameters

color ConsoleColor

SetMode(ConsoleMode)

public void SetMode(ThreadSafeConsoleManager.ConsoleMode mode)

Parameters

mode ThreadSafeConsoleManager.ConsoleMode

Write(string)

public void Write(string text)

Parameters

text string

WriteLine(string)

public void WriteLine(string text = "")

Parameters

text string