1
Plugins / Re: Additional Tagging and Reporting Tools
« on: August 14, 2011, 02:36:26 PM »
The common way to do this is to have a central work queue. Whenever the user confirms an operation, an object representing that operation is pushed into the work queue and a thread backing the queue is pinged. The worker thread associated with the queue simply runs the operations in the queue in order and sleeps when the queue is empty. This provides serialization (i.e. operations which iterate through a library query do not overlap and close each others' queries) and you can add any kind of UI to this, such as a little window that pops up while the queue is non empty, showing a label for the operation in progress, a progress bar and an abort button. If you're careful not to do any actual work in that window's UI code (shouldn't be a problem, after all it merely controls the worker thread and doesn't do the actual work), you can even put this into the MB GUI thread without causing problems.
Steven, couldn't you return a query "handle"? The initual query returns a handle, GetNext requires this handle and once done, the handle is disposed with an EndQuery call. That'd allow for simulatenous queries in a C++-like fashion and C# devs could roll the handle into a custom enumerator which calls EndQuery upon disposal / finalization.
Steven, couldn't you return a query "handle"? The initual query returns a handle, GetNext requires this handle and once done, the handle is disposed with an EndQuery call. That'd allow for simulatenous queries in a C++-like fashion and C# devs could roll the handle into a custom enumerator which calls EndQuery upon disposal / finalization.