views:

547

answers:

2

In the application I'm working on, I've been trying to use the SaveFileDialog and OpenFileDialog for their customary purpose (saving and opening files.)

However, the application can't support modal forms/dialogs without crashing because too many time-sensitive things happen on the thread that owns the UI.

Rewriting the application to move those features off the UI-owning thread is not practical in the immediate term. To finish the feature I've been working on, I need a substitute for the two file dialogs, preferably a control that can live on a non-modal form.

Is there anything out there I can use that won't block my UI-owning thread?

+2  A: 

too many time-sensitive things happen on the thread that owns the UI.

That is your real problem. .Net has very robust multi-threading support. I suggest you move these things elsewhere, unpleasant though it seems. It's probably less work than re-implementing the Open/Save dialogs and definitely will be less for your app in the long run.

Joel Coehoorn
As I wrote in the original question, rewriting the application to move those features off the UI-owning thread is not practical in the immediate term. Obviously, we want to do that at some point, but it's a big task involving rearranging the guts of an application that runs to roughly 500 klocs.
Jekke
+1  A: 

The only existing option I know of is Dialog Workshop.NET, a commercial product. They have a set of dialogs that have the option of being modeless (or embedded directly into a windows form instead of a separate window).

However, I'd really think about trying to move your time sensitive logic into a separate thread, instead. Having a modeless dialog will potentially confuse users, since it will not behave the way a file dialog is supposed to behave. There are also other potential consequences to having a non-blockable UI.

Reed Copsey
As I wrote in the original question (and repeated above,) rewriting the application to move those features off the UI-owning thread is not practical in the immediate term. Obviously, we want to do that at some point, but it's a big task involving rearranging the guts of an application that runs to roughly 500 klocs.
Jekke
@Jekke: There is an option there that doesn't require that - I was just saying that I do believe doing that will be worthwhile, and should be considered, although it sounds like you have. The Dialog Workshop.NET will provide you cheap modeless dialog windows for the immediate term, though.
Reed Copsey