I would like to display elements from Queuein Gridview in Windows Forms. I can set the datasource attribute for Gridview to Queue, but it will not automatically update. I know that I can use the class BindingList, but then I lose functionality Queue.
Is there a way to combine two classes, or do I need to implement one of the behavior in a derived class?
What I am doing is processing the list of elements, I want to show the remaining in the grid. The data should not be modified by the user, but I want the GridView to be updated as the contents of the queue change.
Example:
In the shape of:
Proccessor pro = new Processor();
gridview.DataSource = pro.Items;
In the class:
class Proccessor {
Queue<DataBlock> _queue = new Queue();
public Queue<DataBlock> Items {
get {
return _queue;
}
}
public void AutoProcess() {
while (_queue.Count > 0) {
Process(_queue.Dequeue());
}
}
private void Process(DataBlock db) { ... }
}
source
share