[MonoDevelop] One-shot dialogs from add-ins

Lluis Sanchez Gual lluis at novell.com
Wed Mar 18 06:20:40 EDT 2009


El dt 17 de 03 de 2009 a les 15:06 -0700, en/na Casey Marshall va
escriure:
> I'm working on a version control addin for MonoDevelop 2.0 (beta 2),
> and would like to have it pop up a simple dialog requesting the user's
> password if needed. I'm able to make the dialog appear OK (I'm using
> MessageService.GetPassword, but also tried creating a new Gtk.Dialog
> myself), but I can't seem to be able to make it a "one shot" window --
> only one instance of the window should appear, and if multiple VC
> commands need to execute, they should all wait for the same dialog to
> return.
> 
> Is it possible to do this? I've tried three different approaches, and
> none of them have worked.

First of all you should take into account that MD may execute VS
operations in a thread other than the main GUI thread, so you should
make sure that the dialog is created in the GUI thread. MessageService
will automatically do it for you, but if you create your own dialog,
you'll have to take care of the thread transition.

To make the dialog "one shot", ensure that the dialog is modal
(MessageService.GetPassword already is), and put a lock around the code
that shows the dialog. This should be enough.

Lluis.


> 
> Thanks.
> _______________________________________________
> Monodevelop-list mailing list
> Monodevelop-list at lists.ximian.com
> http://lists.ximian.com/mailman/listinfo/monodevelop-list



More information about the Monodevelop-list mailing list