2
0
mirror of https://github.com/9ParsonsB/Pulsar.git synced 2025-07-02 00:43:42 -04:00

[Core + Framework] Performance improvements for re-drawing the grid (#141)

This proposes a *new method* on IObservatoryCore:  `SetGridItems(worker, items)` which does 2 things:
* Clears the grid
* Adds the given items.

Effectively replaces the entire content of the grid -- which is something a handful of plugins now do.

Why add this when you could just call Core's Clear + AddGridItems methods?? So it can all be done within the same rendering suppression "scope" to reduce flickering and increase rendering speed.  Speaking of rendering suppression, I have implemented such rendering suppression "scope" which uses Listview's built-in Begin/EndUpdate() in combination with temporary removal of the sort comparer (as is done for read-alls).  This was also applied to the existing AddGridItems(worker, items) method as well, addressing a TODO.
This commit is contained in:
F K
2024-01-30 20:49:53 -05:00
committed by GitHub
parent f4759072d2
commit 231710ca68
5 changed files with 89 additions and 6 deletions

View File

@ -187,6 +187,13 @@ namespace Observatory.Framework.Interfaces
/// <param name="items">Grid items to be added. Object types should match original template item used to create the grid.</param>
public void AddGridItems(IObservatoryWorker worker, IEnumerable<object> items);
/// <summary>
/// Replace the contents of the grid with the provided items.
/// </summary>
/// <param name="worker">Reference to the calling plugin's worker interface.</param>
/// <param name="items">Grid items to be added. Object types should match original template item used to create the grid.</param>
public void SetGridItems(IObservatoryWorker worker, IEnumerable<object> items);
/// <summary>
/// Clears basic UI grid, removing all items.
/// </summary>