This documentation is for the old version. Go to the latest Graphics Mill docs

IQueueItem Interface

This interface represents list items which can be loaded to the ThumbnailListView control asynchronously.

Namespace: Aurigma.GraphicsMill.WinControls
Assembly: Aurigma.GraphicsMill.WinControls (in Aurigma.GraphicsMill.WinControls.dll)

Syntax

Visual Basic
Public Interface IQueueItem
C#
public interface IQueueItem

Remarks

If you implement your own thumbnail list items, you can implement this interface to be able to load them to the ThumbnailListView control asynchronously. It is important if you are going to load a big number of your items in the control at the same time. In synchronous mode the application will freeze until all items will be loaded. Obviously it is inconvenient to the end user.

This interface is based on concepts of methods. The method is a code which evaluates a piece of item data. Each method is identified by the zero-based index. When the control starts loading items, it creates several threads, as many as many methods items have. After that it organizes all items into queues (one queue for each thread). It launches evaluation of the appropriate method for first item in the queue for each threads. When it completes, it takes the next item in the queue, etc.

For example, if you implement an item which displays goods from the warehouse database, and you extract its name, description, photo, and price, you can have 4 methods: one for each piece of data. The method 0 will evaluate name, the method 1 - description, the method 2 - photo, and the method 3 - price.

Implementation of this interface is quite straightforward. First of all, you should implement the MethodCount method. It should return a number of methods this item supports. In our example it will be 4.

The EvaluateMethod(Int32) should get the necessary piece of data (according to the specified method index). In our example, you should use the similar switch statement:

// ...
switch(methodIndex)
{
  case 0:
    // ... Fetch item name
    break;
  case 1:
    // ... Fetch item description
    break;
  case 2:
    // ... Fetch item photo
    break;
  case 3:
    // ... Fetch item price
    break;
}
// ...

For each method you should return value which indicates whether the method has been started or completed. This way the control will be able to determine whether to proceed with the next item. Use the GetMethodState(Int32) method for it.

You may wonder how to affect the queue when you implement the list item. For example, if the control request an icon or thumbnail of the item, it makes sense to pop the item to the head of the queue. To do it, use the MoveToHead(IQueueItem, Int32) method of the QueueManager stored in the parent of the item.

See Also

Reference