Table of Contents

Class MainWindow

Namespace
EchoHub.Client.UI
Assembly
EchoHub.Client.dll

Main Terminal.Gui window for the EchoHub chat client.

public sealed class MainWindow : Runnable, IDisposable, IRunnable
Inheritance
MainWindow
Implements
Inherited Members

Constructors

MainWindow(IApplication, ChatMessageManager)

public MainWindow(IApplication app, ChatMessageManager messageManager)

Parameters

app IApplication
messageManager ChatMessageManager

Properties

CurrentChannel

Get the current channel name.

public string CurrentChannel { get; }

Property Value

string

Methods

ApplyColorSchemes()

Applies the currently registered color schemes to all views. Call after theme changes to refresh colors.

public void ApplyColorSchemes()

ClearAll()

Clear all messages and channels (used on disconnect).

public void ClearAll()

EnsureChannelInList(string, bool?)

Ensure a channel exists in the left panel list (used for private channels joined via /join).

public void EnsureChannelInList(string channelName, bool? isPublic = null)

Parameters

channelName string
isPublic bool?

FocusInput()

Focus the input field for typing.

public void FocusInput()

GetChannelNames()

Get all channel names that have message buffers (for broadcasting status changes).

public IReadOnlyList<string> GetChannelNames()

Returns

IReadOnlyList<string>

RefreshMenuBar()

Rebuilds and replaces the menu bar (e.g., after theme list changes).

public void RefreshMenuBar()

RemoveChannel(string)

Remove a channel from the left panel list.

public void RemoveChannel(string channelName)

Parameters

channelName string

SetChannelTopic(string, string?)

Update the topic for a specific channel.

public void SetChannelTopic(string channelName, string? topic)

Parameters

channelName string
topic string

SetChannels(List<ChannelDto>)

Set the list of available channels, storing topics, and refresh the channel list view.

public void SetChannels(List<ChannelDto> channels)

Parameters

channels List<ChannelDto>

SetCurrentUser(string)

Set the current user name (delegates to message manager for @mention detection).

public void SetCurrentUser(string username)

Parameters

username string

ShowError(string)

Show an error message to the user.

public void ShowError(string message)

Parameters

message string

SwitchToChannel(string)

Switch the chat view to the given channel, resetting its unread count and updating the topic bar.

public void SwitchToChannel(string channelName)

Parameters

channelName string

ToggleUsersPanel()

Toggle the online users panel visibility (F2).

public void ToggleUsersPanel()

UpdateOnlineUsers(List<UserPresenceDto>)

Update the online users list display.

public void UpdateOnlineUsers(List<UserPresenceDto> users)

Parameters

users List<UserPresenceDto>

UpdateStatusBar(string)

Update the connection status displayed in the status bar.

public void UpdateStatusBar(string status)

Parameters

status string

Events

OnAudioPlayRequested

Fired when the user activates (Enter/click) an audio message. Parameters: attachmentUrl, fileName.

public event Action<string, string>? OnAudioPlayRequested

Event Type

Action<string, string>

OnChannelSelected

Fired when the user selects a channel. Parameter is the channel name.

public event Action<string>? OnChannelSelected

Event Type

Action<string>

OnConnectRequested

Fired when the user requests to connect via the menu.

public event Action? OnConnectRequested

Event Type

Action

OnCreateChannelRequested

Fired when the user requests to create a new channel.

public event Action? OnCreateChannelRequested

Event Type

Action

OnDeleteChannelRequested

Fired when the user requests to delete the current channel.

public event Action? OnDeleteChannelRequested

Event Type

Action

OnDisconnectRequested

Fired when the user requests to disconnect via the menu.

public event Action? OnDisconnectRequested

Event Type

Action

OnFileDownloadRequested

Fired when the user activates (Enter/click) a file message. Parameters: attachmentUrl, fileName.

public event Action<string, string>? OnFileDownloadRequested

Event Type

Action<string, string>

OnLogoutRequested

Fired when the user requests to logout (disconnect + revoke session).

public event Action? OnLogoutRequested

Event Type

Action

OnMessageSubmitted

Fired when the user presses Enter in the input field. Parameters: channel name, message content.

public event Action<string, string>? OnMessageSubmitted

Event Type

Action<string, string>

OnProfileRequested

Fired when the user requests to open their profile panel.

public event Action? OnProfileRequested

Event Type

Action

OnSavedServersRequested

Fired when the user requests to view saved servers.

public event Action? OnSavedServersRequested

Event Type

Action

OnStatusRequested

Fired when the user requests to set their status.

public event Action? OnStatusRequested

Event Type

Action

OnThemeSelected

Fired when the user selects a theme from the menu. Parameter is the theme name.

public event Action<string>? OnThemeSelected

Event Type

Action<string>