Method AddItemsThreadSafe
AddItemsThreadSafe<TSource>(IEnumerable<TSource>, Func<TSource, ListControlItem?>, Func<bool>, int, int)
Allows to set items from the IEnumerable<T> with huge number of items which is "yield" constructed. This method can be called from the another thread which is different from UI thread.
public virtual void AddItemsThreadSafe<TSource>(IEnumerable<TSource> source, Func<TSource, ListControlItem?> convertItem, Func<bool> continueFunc, int bufferSize = 10, int sleepAfterBufferMsec = 150)
Parameters
source
IEnumerable<TSource>The IEnumerable<T> instance which is "yield" constructed in the another thread.
convertItem
Func<TSource, ListControlItem>The function which is called to convert
source
items to the items which can be used in this control. If this function returns Null, source item is ignored. This function is called from the thread that providessource
so do not access UI elements from it.continueFunc
Func<bool>The function which is called to check whether to continue the conversion. You can return False to stop the conversion. This function is called from the main thread so it can access UI elements.
bufferSize
intSize of the items buffer. Optional. Default is 10.
sleepAfterBufferMsec
intThe value in milliseconds to wait after buffer is converted and all buffered items were added to the control. Optional. Default is 150.
Type Parameters
TSource
The type of the item in the source enumerable.