Table of Contents

Class ChannelListSource

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

Custom list data source for colored channel list rendering. Active channel gets a > indicator, unread channels are bright with a count badge.

public class ChannelListSource : IListDataSource, IDisposable
Inheritance
ChannelListSource
Implements
Inherited Members

Constructors

ChannelListSource()

public ChannelListSource()

Properties

Count

Gets the number of items in the data source.

public int Count { get; }

Property Value

int

MaxItemLength

Gets the width in columns of the widest item in the data source.

public int MaxItemLength { get; }

Property Value

int

Remarks

ListView uses this value to set its horizontal content size for scrolling.

SuspendCollectionChangedEvent

Gets or sets whether the CollectionChanged event should be suppressed.

public bool SuspendCollectionChangedEvent { get; set; }

Property Value

bool

Remarks

Set to true to prevent CollectionChanged from being raised during bulk operations. Set back to false to resume event notifications.

Methods

Dispose()

public void Dispose()

IsMarked(int)

Determines whether the specified item is marked.

public bool IsMarked(int item)

Parameters

item int

The zero-based index of the item.

Returns

bool

true if the item is marked; otherwise false.

Remarks

ListView calls this method to determine whether to render the item with a mark indicator when ShowMarks is true.

Render(ListView, bool, int, int, int, int, int)

Renders the specified item to the ListView.

public void Render(ListView listView, bool selected, int item, int col, int row, int width, int viewportX = 0)

Parameters

listView ListView

The ListView to render to.

selected bool

true if the item is currently selected; otherwise false.

item int

The zero-based index of the item to render.

col int

The column in listView Viewport where rendering starts.

row int

The row in listView Viewport where rendering starts.

width int

The width available for rendering.

viewportX int

The horizontal scroll offset.

Remarks

ListView calls this method for each visible item during rendering. The color scheme will be set based on selection state before this method is called.

Implementations must fill the entire width to avoid rendering artifacts.

SetMark(int, bool)

Sets the marked state of the specified item.

public void SetMark(int item, bool value)

Parameters

item int

The zero-based index of the item.

value bool

true to mark the item; false to unmark it.

Remarks

ListView calls this method when the user toggles marking (e.g., via the SPACE key) if ShowMarks is true.

ToList()

Returns the underlying data source as an System.Collections.IList.

public IList ToList()

Returns

IList

The data source as an System.Collections.IList.

Remarks

ListView uses this method to access individual items for events like ValueChanged and to enable keyboard search via KeystrokeNavigator.

Update(List<string>, Dictionary<string, int>, string)

public void Update(List<string> channels, Dictionary<string, int> unread, string activeChannel)

Parameters

channels List<string>
unread Dictionary<string, int>
activeChannel string

Events

CollectionChanged

Raised when items are added, removed, moved, or the entire collection is refreshed.

public event NotifyCollectionChangedEventHandler? CollectionChanged

Event Type

NotifyCollectionChangedEventHandler

Remarks

ListView subscribes to this event to update its display and content size when the data changes. Implementations should raise this event whenever the underlying collection changes, unless SuspendCollectionChangedEvent is true.