I am using gui.cs.
I have a ListView that shows network nodes. These nodes come and go so the list gets updated on the right events.
var clients = new List<Node>();
var clientList = new ListView(clients)
{
Height = Dim.Fill(),
Width = Dim.Fill(),
};
server.NodeJoined += (s, e) =>
{
clients.Add(e.Node);
Application.Refresh();
};
server.NodeLeft += (s, e) =>
{
var client = clients.FirstOrDefault(n => n.IP == e.Node.IP);
if (client != null) clients.Remove(client);
Application.Refresh();
};
Currently I'm using the Application.Refresh()
which updates the whole UI. Ideally only the changed parts should be updated. Is this correct or is there a better way to inform ListView
that the data source has changed and it needs a redraw?