Thanks in advance for any help. Sorry if it's a silly question - though I have done a quick search of the forums and found nothing.
I'm aware that, because of the way XNA uses the graphics device, standard windows buttons etc. can't be used in the main game window. So I wrote a quick form to show some diagnostics / settings outside of the main window. All OK.
I now want that form to have a 'save as' button, to save the current file I've been editing in the underlying XNA code. However when I launch a SaveFileDialog from the form I get a "System.Threading.ThreadStateException".
Is that because XNA doesn't like modal forms Why does it handle my form OK but not this standard dialgo
I'm guessing I could write my own Save As dialog, write it non-modally, and then that would work ok But is there anyway to get round this using the standard windows dialog Or do I have to reinvent the wheel
Pseudo code:
Game.Update()
{
MyForm form1 = new MyForm();
myForm.Show();
// use a delegate to wait for the non-modal MyForm to close
}
class MyForm
{
MyForm() // Constructor
SaveAsButton_Click (,)
{
SaveFileDialog sfd = new SaveFileDialog();
// set members
result = sfd.ShowDialog(); // -> Error
}
}
Thanks a lot!