This is a very usual issue: instances of certain types or certain facilities can only work in one single thread. This limitation is done to simplify their code. You need to follow this design and execute all corresponding parts of code by the same thread.
It does not mean that you cannot use multiple threads. If you need collaboration between thread, you will need to use thread synchronization and inter-thread communication. In particular, there is an invocation mechanism to delegate some action from one thread to a UI thread. Please see my past answers:
Control.Invoke() vs. Control.BeginInvoke()[
^],
Problem with Treeview Scanner And MD5[
^].
If you want to develop some non-UI thread to invoke delegates from other thread, you will need to use a loop and create some analogous mechanism. Please see:
http://msdn.microsoft.com/en-us/library/dd267312%28v=vs.110%29.aspx[
^],
http://msdn.microsoft.com/en-us/library/dd997371%28v=vs.110%29.aspx[
^].
In my article, I explained how such things work, without using
BlockingCollection
:
Simple Blocking Queue for Thread Communication and Inter-thread Invocation[
^].
—SA