Table of Contents

Class StatusBarStateService

Namespace
SharpConsoleUI.Core
Assembly
SharpConsoleUI.dll

Manages status bar state, Start menu actions, and status bar bounds. Centralized state service for all status bar and start menu functionality.

public class StatusBarStateService
Inheritance
StatusBarStateService
Inherited Members

Constructors

StatusBarStateService(ILogService, Func<ConsoleWindowSystem>)

Initializes a new instance of the StatusBarStateService class.

public StatusBarStateService(ILogService logService, Func<ConsoleWindowSystem> getWindowSystem)

Parameters

logService ILogService

Service for debug logging.

getWindowSystem Func<ConsoleWindowSystem>

Function to get the window system (lazy to avoid circular dependency).

Properties

BottomStatus

Gets or sets the text displayed in the bottom status bar.

public string BottomStatus { get; set; }

Property Value

string

BottomStatusBarBounds

Gets the bottom status bar bounds for mouse hit testing.

public Rectangle BottomStatusBarBounds { get; }

Property Value

Rectangle

ShowBottomStatus

Gets or sets whether the bottom status bar is visible. Changing this affects desktop dimensions and triggers window invalidation.

public bool ShowBottomStatus { get; set; }

Property Value

bool

ShowTopStatus

Gets or sets whether the top status bar is visible. Changing this affects desktop dimensions and triggers window invalidation.

public bool ShowTopStatus { get; set; }

Property Value

bool

StartButtonBounds

Gets the start button bounds for mouse hit testing.

public Rectangle StartButtonBounds { get; }

Property Value

Rectangle

TopStatus

Gets or sets the text displayed in the top status bar.

public string TopStatus { get; set; }

Property Value

string

TopStatusBarBounds

Gets the top status bar bounds for mouse hit testing.

public Rectangle TopStatusBarBounds { get; }

Property Value

Rectangle

Methods

GetBottomStatusHeight(bool, bool, bool, StatusBarLocation)

Gets the height occupied by the bottom status bar (0 or 1). Accounts for both status text and Start button.

public int GetBottomStatusHeight(bool showBottomStatus, bool showTaskBar, bool showStartButton, StatusBarLocation startButtonLocation)

Parameters

showBottomStatus bool

Whether the bottom status bar is enabled.

showTaskBar bool

Whether the task bar (window list) is enabled.

showStartButton bool

Whether the start button is enabled.

startButtonLocation StatusBarLocation

Location of the start button.

Returns

int

Height in rows (0 or 1).

GetStartMenuActions()

Gets all registered Start menu actions.

public IReadOnlyList<StartMenuAction> GetStartMenuActions()

Returns

IReadOnlyList<StartMenuAction>

Read-only list of actions.

GetTopStatusHeight(bool, bool)

Gets the height occupied by the top status bar (0 or 1). Accounts for both status text and performance metrics.

public int GetTopStatusHeight(bool showTopStatus, bool enablePerformanceMetrics)

Parameters

showTopStatus bool

Whether the top status bar is enabled.

enablePerformanceMetrics bool

Whether performance metrics are enabled.

Returns

int

Height in rows (0 or 1).

HandleStatusBarClick(int, int)

Handles status bar mouse click (e.g., start button).

public bool HandleStatusBarClick(int x, int y)

Parameters

x int

X coordinate of click.

y int

Y coordinate of click.

Returns

bool

True if the click was handled; false otherwise.

RegisterStartMenuAction(string, Action, string?, int)

Registers a new action in the Start menu.

public void RegisterStartMenuAction(string name, Action callback, string? category = null, int order = 0)

Parameters

name string

Display name of the action.

callback Action

Callback to execute when action is selected.

category string

Optional category for grouping actions.

order int

Display order (lower values appear first).

ShowStartMenu()

Shows the Start menu dialog.

public void ShowStartMenu()

UnregisterStartMenuAction(string)

Removes an action from the Start menu by name.

public void UnregisterStartMenuAction(string name)

Parameters

name string

Name of the action to remove.

UpdateStatusBarBounds(int, int, bool, bool, StatusBarOptions)

Updates the status bar bounds based on current screen size and configuration. Call this after screen resizes or configuration changes.

public void UpdateStatusBarBounds(int screenWidth, int screenHeight, bool showTopStatus, bool showBottomStatus, StatusBarOptions options)

Parameters

screenWidth int

Current screen width.

screenHeight int

Current screen height.

showTopStatus bool

Whether the top status bar is enabled.

showBottomStatus bool

Whether the bottom status bar is enabled.

options StatusBarOptions

Status bar configuration options.