I'm trying to write a service that act as a print spooler : it waits for documents to print and print the on the right printer with the right settings (stored in a PrintTicket).
Each time a bunch of document is coming a thread is created for each setting and the documents are printed in parallel in their thread.
It works when I use a WPF application, but when I use the same code in a windows service I sometimes get this error on the PrintDialog.PrintVisual function call :
the calling thread cannot access this object because a different thread owns it
When googling for this error I often end up with this thread safe print dialog, but it doesn't provide the PrintVisual function.
Any other idea on how to get rid of this error ?
Thanks for your help