I get the following exception when calling saveFileDialog.ShowDialog() in a background thread:
Current thread must be set to single thr
On your MainForm:
if (this.InvokeRequired) {
this.Invoke(saveFileDialog.ShowDialog());
} else {
saveFileDialog.ShowDialog();
}
Or, if you will have other methods that need to be run from the UI thread:
private void DoOnUIThread(MethodInvoker d) {
if (this.InvokeRequired) { this.Invoke(d); } else { d(); }
}
Then, call your method as such:
DoOnUIThread(delegate() {
saveFileDialog.ShowDialog();
});