Our applications do some fairly heavy processing and I "played" around with this as well - having no experience with threading.
I also ended up with the UI on the new thread, but I was having problems with using DoEvents to keep the UI responsive and ended up not using them, but making the Revit window the parent of my UI form seemed to help - unfortunately I didnt make a note of any references where that suggestion came from.
The UI is responsive when running, but we dont call any single API method that takes a long time, like your Export call. When debugging I do occasionally get cross thread exceptions thrown, but so far no users have reported any such problems.
Some code snippets
Code:
System.Diagnostics.Process currentProcess = System.Diagnostics.Process.GetCurrentProcess();
System.IntPtr hWndRevit = currentProcess.MainWindowHandle;
m_testForm = new ImportForm(hWndRevit, m_sImportName);
Thread t = new Thread(new ThreadStart(new Shared.AppState(m_testForm).RunApp));
t.SetApartmentState(ApartmentState.STA);
t.IsBackground = false;
t.Start();
--------------------
Code:
private void ImportForm_Load(object sender, EventArgs e)
{
IntPtr hWndTest = Handle;
if (m_hWndRevit != IntPtr.Zero && hWndTest != IntPtr.Zero)
SetParent(hWndTest, m_hWndRevit);
}
----------------------