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
sourceIEnumerable<TSource>The IEnumerable<T> instance which is "yield" constructed in the another thread.
convertItemFunc<TSource, ListControlItem>The function which is called to convert
sourceitems 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 providessourceso do not access UI elements from it.continueFuncFunc<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.
bufferSizeintSize of the items buffer. Optional. Default is 10.
sleepAfterBufferMsecintThe value in milliseconds to wait after buffer is converted and all buffered items were added to the control. Optional. Default is 150.
Type Parameters
TSourceThe type of the item in the source enumerable.