示例#1
0
        /// <summary>
        /// On macOS, this displays a modal dialog that shows a message and certificate information,
        /// and gives the user the option of trusting/importing the certificate. If you provide a
        /// browserWindow argument the dialog will be attached to the parent window, making it modal.
        /// </summary>
        /// <param name="browserWindow"></param>
        /// <param name="options"></param>
        /// <returns></returns>
        public Task ShowCertificateTrustDialogAsync(BrowserWindow browserWindow, CertificateTrustDialogOptions options)
        {
            var    taskCompletionSource = new TaskCompletionSource <object>(TaskCreationOptions.RunContinuationsAsynchronously);
            string guid = Guid.NewGuid().ToString();

            BridgeConnector.On("showCertificateTrustDialogComplete" + guid, () =>
            {
                BridgeConnector.Off("showCertificateTrustDialogComplete" + guid);
                taskCompletionSource.SetResult(null);
            });

            BridgeConnector.Emit("showCertificateTrustDialog", browserWindow, options, guid);

            return(taskCompletionSource.Task);
        }
示例#2
0
        /// <summary>
        /// On macOS, this displays a modal dialog that shows a message and certificate information,
        /// and gives the user the option of trusting/importing the certificate. If you provide a
        /// browserWindow argument the dialog will be attached to the parent window, making it modal.
        /// </summary>
        /// <param name="browserWindow"></param>
        /// <param name="options"></param>
        /// <returns></returns>
        public Task ShowCertificateTrustDialogAsync(BrowserWindow browserWindow, CertificateTrustDialogOptions options)
        {
            var taskCompletionSource = new TaskCompletionSource <object>();

            BridgeConnector.Socket.On("showCertificateTrustDialogComplete", () =>
            {
                BridgeConnector.Socket.Off("showCertificateTrustDialogComplete");
                taskCompletionSource.SetResult(null);
            });

            BridgeConnector.Socket.Emit("showCertificateTrustDialog",
                                        JObject.FromObject(browserWindow, _jsonSerializer),
                                        JObject.FromObject(options, _jsonSerializer));

            return(taskCompletionSource.Task);
        }
示例#3
0
 /// <summary>
 /// On macOS, this displays a modal dialog that shows a message and certificate information,
 /// and gives the user the option of trusting/importing the certificate. If you provide a
 /// browserWindow argument the dialog will be attached to the parent window, making it modal.
 /// </summary>
 /// <param name="options"></param>
 /// <returns></returns>
 public Task ShowCertificateTrustDialogAsync(CertificateTrustDialogOptions options)
 {
     return(ShowCertificateTrustDialogAsync(null, options));
 }