Class TreeState
- Namespace
- MiniTui
- Assembly
- MiniTui.dll
Creating a TreeState<T> whose children load asynchronously.
public static class TreeState
- Inheritance
-
TreeState
- Inherited Members
Methods
Async<T>(Func<T, CancellationToken, Task<IReadOnlyList<T>>>, Func<T, string>, IEqualityComparer<T>?)
Create a state whose children are loaded asynchronously (1.x spec §18.6): when a node first expands, its label
shows "Loading…" until loadChildren finishes, and the children are kept until
Reload(T). A load that throws shows its message on the row and collapses the node.
public static TreeState<T> Async<T>(Func<T, CancellationToken, Task<IReadOnlyList<T>>> loadChildren, Func<T, string> text, IEqualityComparer<T>? comparer = null) where T : class
Parameters
loadChildrenFunc<T, CancellationToken, Task<IReadOnlyList<T>>>Loads a node's children. Runs through RunTask(Func<CancellationToken, Task>) while an app is running.
textFunc<T, string>A node's label: drawn by default, and searched by type-ahead.
comparerIEqualityComparer<T>How nodes are matched, for the expanded set, the selection and the loaded children.
Returns
- TreeState<T>
Type Parameters
T