public bool GetIsCertificateTrusted(string uri, string certificateFingerprint) { bool value; if (!TrustedCertificates.TryGetValue(certificateFingerprint, out value)) { DispatchService.GuiSyncDispatch(delegate { value = MessageService.AskQuestion( "Untrusted HTTP certificate detected", string.Format("Do you want to temporarily trust this certificate in order to" + " connect to the server at {0}?", uri), AlertButton.Yes, AlertButton.No) == AlertButton.Yes; TrustedCertificates [certificateFingerprint] = value; }); } return(value); }
/// <summary> /// Places and runs a transient dialog. Does not destroy it, so values can be retrieved from its widgets. /// </summary> public static int RunCustomDialog(Dialog dialog, Window parent) { // if dialog is modal, make sure it's parented on any existing modal dialog if (dialog.Modal) { parent = GetDefaultModalParent(); } //ensure the dialog has a parent if (parent == null) { parent = dialog.TransientFor ?? RootWindow; } dialog.TransientFor = parent; dialog.DestroyWithParent = true; if (dialog.Title == null) { dialog.Title = BrandingService.ApplicationName; } #if MAC DispatchService.GuiSyncDispatch(() => { // If there is a native NSWindow model window running, we need // to show the new dialog over that window. if (NSApplication.SharedApplication.ModalWindow != null) { dialog.Shown += HandleShown; } else { PlaceDialog(dialog, parent); } }); #endif return(Mono.TextEditor.GtkWorkarounds.RunDialogWithNotification(dialog)); }