Class MainWindow
Main Terminal.Gui window for the EchoHub chat client.
public sealed class MainWindow : Runnable, IDisposable, ISupportInitializeNotification, ISupportInitialize, IRunnable
- Inheritance
-
ViewRunnableMainWindow
- Implements
-
IRunnable
- Inherited Members
-
Runnable.SetApp(IApplication)Runnable.RequestStop()Runnable.ResultRunnable.IsRunningRunnable.IsModalRunnable.StopRequestedRunnable.IsRunningChangingRunnable.IsRunningChangedRunnable.IsModalChangedView.NewMouseEvent(Mouse)View.RaiseMouseEvent(Mouse)View.GetAdornmentsThickness()View.GetSupportedCommands()View.InvokeCommands(Command[], IInputBinding)View.InvokeCommand(Command, IInputBinding)View.InvokeCommand(Command, ICommandContext)View.InvokeCommand(Command)View.GetContentSize()View.GetWidthRequiredForSubViews()View.GetHeightRequiredForSubViews()View.ViewportToScreen()View.GetViewportOffsetFromFrame()View.Dispose()View.ToString()View.ToDebugString()View.BeginInit()View.EndInit()View.OnEnabledChanged()View.SetCursorNeedsUpdate()View.GetCurrentAttribute()View.GetAttributeForRole(VisualRole)View.SetAttribute(Attribute)View.SetAttributeForRole(VisualRole)View.GetClip()View.SetClip(Region)View.SetClipToScreen()View.ExcludeFromClip(Region)View.AddViewportToClip()View.Draw(DrawContext)View.DrawAdornments()View.ClearViewport(DrawContext)View.DrawText(DrawContext)View.DrawSubViews(DrawContext)View.RenderLineCanvas(DrawContext)View.GetScheme()View.SetScheme(Scheme)View.Add(View)View.Add(params View[])View.Remove(View)View.RemoveAll()View.RemoveAll<TView>()View.MoveSubViewTowardsEnd(View)View.MoveSubViewToEnd(View)View.MoveSubViewTowardsStart(View)View.MoveSubViewToStart(View)View.AssignHotKeysToSubViews()View.NewKeyDownEvent(Key)View.FrameToScreen()View.Layout()View.SetNeedsLayout()View.GetContainerSize()View.AdvanceFocus(NavigationDirection, TabBehavior?)View.FocusDeepest(NavigationDirection, TabBehavior?)View.OnCanFocusChanged()View.ClearFocus()View.SetFocus()View.SetNeedsDraw()View.OnTextChanged()View.MouseBindingsView.MouseHoldRepeatView.MousePositionTrackingView.MouseStateView.MouseHighlightStatesView.MarginView.ShadowStyleView.BorderView.BorderStyleView.PaddingView.ArrangementView.ContentSizeTracksViewportView.ViewportSettingsView.ViewportView.DataView.IdView.AppView.IsInitializedView.EnabledView.VisibleView.TitleView.CursorView.DiagnosticsView.LineCanvasView.SuperViewRendersLineCanvasView.SchemeNameView.HasSchemeView.SubViewsView.SuperViewView.HotKeyView.HotKeySpecifierView.AssignHotKeysView.UsedHotKeysView.KeyBindingsView.HotKeyBindingsView.FrameView.XView.YView.HeightView.WidthView.NeedsLayoutView.ValidatePosDimView.CanFocusView.FocusedView.IsCurrentTopView.MostFocusedView.HasFocusView.TabStopView.NeedsDrawView.HorizontalScrollBarView.VerticalScrollBarView.PreserveTrailingSpacesView.TextView.TextAlignmentView.TextDirectionView.TextFormatterView.VerticalTextAlignmentView.MouseEnterView.MouseLeaveView.MouseHoldRepeatChangingView.MouseHoldRepeatChangedView.MouseEventView.MouseStateChangedView.BorderStyleChangedView.CommandNotBoundView.AcceptingView.AcceptedView.ActivatingView.HandlingHotKeyView.ContentSizeChangingView.ContentSizeChangedView.ViewportChangedView.DisposingView.InitializedView.EnabledChangedView.VisibleChangingView.VisibleChangedView.TitleChangingView.TitleChangedView.GettingAttributeForRoleView.ClearingViewportView.ClearedViewportView.DrawingTextView.DrewTextView.DrawingContentView.DrawingSubViewsView.DrawCompleteView.SchemeNameChangingView.SchemeNameChangedView.GettingSchemeView.SchemeChangingView.SchemeChangedView.SuperViewChangingView.SuperViewChangedView.SubViewAddedView.SubViewRemovedView.RemovedView.HotKeyChangedView.KeyDownView.KeyDownNotHandledView.FrameChangedView.HeightChangingView.HeightChangedView.WidthChangingView.WidthChangedView.SubViewLayoutView.SubViewsLaidOutView.AdvancingFocusView.CanFocusChangedView.FocusedChangedView.HasFocusChangingView.HasFocusChangedView.TextChanged
Constructors
MainWindow(IApplication)
public MainWindow(IApplication app)
Parameters
appIApplication
Properties
CurrentChannel
Get the current channel name.
public string CurrentChannel { get; }
Property Value
Methods
AddMessage(MessageDto)
Add a message to the specified channel's message list and refresh if it is the current channel. Tracks unread count for non-active channels.
public void AddMessage(MessageDto message)
Parameters
messageMessageDto
AddStatusMessage(string, string, string)
Add a status change message to a channel with colored styling.
public void AddStatusMessage(string channelName, string username, string status)
Parameters
AddSystemMessage(string, string)
Add a system/informational message to a channel with colored styling.
public void AddSystemMessage(string channelName, string text)
Parameters
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()
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
LoadHistory(string, List<MessageDto>)
Load historical messages into a channel, replacing any existing messages.
public void LoadHistory(string channelName, List<MessageDto> messages)
Parameters
channelNamestringmessagesList<MessageDto>
RefreshMenuBar()
Rebuilds and replaces the menu bar (e.g., after theme list changes).
public void RefreshMenuBar()
SetChannelTopic(string, string?)
Update the topic for a specific channel.
public void SetChannelTopic(string channelName, string? topic)
Parameters
SetChannels(List<ChannelDto>)
Set the list of available channels, storing topics, and refresh the channel list view.
public void SetChannels(List<ChannelDto> channels)
Parameters
channelsList<ChannelDto>
SetCurrentUser(string)
Set the current user name for display in the status bar.
public void SetCurrentUser(string username)
Parameters
usernamestring
ShowError(string)
Show an error message to the user.
public void ShowError(string message)
Parameters
messagestring
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
channelNamestring
UpdateStatusBar(string)
Update the connection status displayed in the status bar.
public void UpdateStatusBar(string status)
Parameters
statusstring
Events
OnChannelSelected
Fired when the user selects a channel. Parameter is the channel name.
public event Action<string>? OnChannelSelected
Event Type
OnConnectRequested
Fired when the user requests to connect via the menu.
public event Action? OnConnectRequested
Event Type
OnCreateChannelRequested
Fired when the user requests to create a new channel.
public event Action? OnCreateChannelRequested
Event Type
OnDisconnectRequested
Fired when the user requests to disconnect via the menu.
public event Action? OnDisconnectRequested
Event Type
OnMessageSubmitted
Fired when the user presses Enter in the input field. Parameters: channel name, message content.
public event Action<string, string>? OnMessageSubmitted
Event Type
OnProfileRequested
Fired when the user requests to open their profile panel.
public event Action? OnProfileRequested
Event Type
OnSavedServersRequested
Fired when the user requests to view saved servers.
public event Action? OnSavedServersRequested
Event Type
OnStatusRequested
Fired when the user requests to set their status.
public event Action? OnStatusRequested
Event Type
OnThemeSelected
Fired when the user selects a theme from the menu. Parameter is the theme name.
public event Action<string>? OnThemeSelected