internal static bool Show(string realm, bool may_save, out string password, out bool save) { string local_password = null; bool local_save = false; bool res = false; object monitor = new Object(); EventHandler del = delegate { ClientCertificatePasswordDialog dlg = new ClientCertificatePasswordDialog(realm, may_save); try { res = (MessageService.RunCustomDialog(dlg) == (int)Gtk.ResponseType.Ok); if (res) { local_save = dlg.Save; local_password = dlg.Password; } } finally { dlg.Destroy(); lock (monitor) { System.Threading.Monitor.Pulse(monitor); } } }; if (GLib.MainContext.Depth > 0) { // Already in GUI thread del(null, null); } else { lock (monitor) { Gtk.Application.Invoke(del); System.Threading.Monitor.Wait(monitor); } } password = local_password; save = local_save; return(res); }
internal static bool Show (string realm, bool may_save, out string password, out bool save) { string local_password = null; bool local_save = false; bool res = false; object monitor = new Object (); EventHandler del = delegate { ClientCertificatePasswordDialog dlg = new ClientCertificatePasswordDialog (realm, may_save); try { res = (MessageService.RunCustomDialog (dlg) == (int) Gtk.ResponseType.Ok); if (res) { local_save = dlg.Save; local_password = dlg.Password; } } finally { dlg.Destroy (); dlg.Dispose (); lock (monitor) { System.Threading.Monitor.Pulse (monitor); } } }; if (GLib.MainContext.Depth > 0) { // Already in GUI thread del (null, null); } else { lock (monitor) { Gtk.Application.Invoke (del); System.Threading.Monitor.Wait (monitor); } } password = local_password; save = local_save; return res; }