Last active
December 13, 2016 15:05
-
-
Save prabindh/524ddd79ae6c9815a97c8d43239bb9f5 to your computer and use it in GitHub Desktop.
JsDialogHandler crash on Prompt dialog and callback continue
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class JsDialogHandler : IJsDialogHandler | |
{ | |
string result = "default"; | |
public bool OnJSDialog(IWebBrowser browserControl, IBrowser browser, string originUrl, | |
CefJsDialogType dialogType, string messageText, string defaultPromptText, | |
IJsDialogCallback callback, ref bool suppressMessage) | |
{ | |
suppressMessage = true; | |
if (dialogType == CefJsDialogType.Prompt) | |
{ | |
parent.Invoke(new Action(() => | |
{ | |
result = ShowTextInputForm(); // Show a form and get text input | |
})); | |
if(null != callback && !callback.IsDisposed) | |
{ | |
callback.Continue(true, result); | |
} | |
} | |
else | |
{ | |
MessageBox.Show(messageText, "Status", MessageBoxButtons.OKCancel, MessageBoxIcon.Asterisk); | |
} | |
return true; | |
} | |
// Rest of class |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment