My previous question (SelectedIndex is unchanging in tabcontrol - Dispatcher issue) didn't get very far, and I suspect I was on the wrong track to begin with.
There are 3 givens in my program:
- I have a main window which is WPF.
- I connect to a separate application (a different process) which implements a COM server which can be called on at various times to perform time-consuming calculations, the results of which I will display in my window.
- I do not want the main window to freeze while waiting for these calculations to conclude. In fact, the operator should be free to continue using the program, though certain controls may be disabled pending conclusion of the asynchronous operation.
It seems to me that to achieve the above requirements that I need to have a separate thread dedictated to handling COM requests and that thread must be STA. Somehow I invoke this thread to do stuff, and somehow this thread invokes the GUI thread to update stuff. It's not clear to me technically how to make this happen.
Two questions: How do I implement these calls between threads? What's a clean architecture for this?