private bool OnJSConfirm(IWebBrowser browser, string message) { PromptDialog dlg = new PromptDialog(); dlg.Text = browser.Title; dlg.PromptText = message; dlg.isPrompt = false; dlg.messageBoxIcon = MessageBoxIcon.Question; bool result = dlg.ShowDialog(Parent) == DialogResult.OK; return result; }
private bool OnJSPrompt(IWebBrowser browser, string message) { PromptDialog dlg = new PromptDialog(); dlg.Text = browser.Title; dlg.PromptText = message; dlg.Value = PromptResult; dlg.messageBoxIcon = MessageBoxIcon.Question; bool result = dlg.ShowDialog(Parent) == DialogResult.OK; if (result) PromptResult = dlg.Value; return result; }
public bool OnJSAlert(IWebBrowser browser, string url, string message) { if (Parent.InvokeRequired) Parent.Invoke(new Func<IWebBrowser, string, string, bool>(OnJSAlert), browser, url, message); else { PromptDialog dlg = new PromptDialog(); dlg.Text = browser.Title; dlg.PromptText = message; dlg.isPrompt = false; dlg.isOKCancel = false; dlg.messageBoxIcon = MessageBoxIcon.Exclamation; dlg.ShowDialog(Parent); } return true; }
private void initScriptEngine() { _engine.SetGlobalFunction("print", new Action<string>((s) => outputString(FixStringLineWrap(s)))); _engine.SetGlobalFunction("printLine", new Action<string>((s) => outputString(FixStringLineWrap(s) + "\r\n"))); _engine.SetGlobalFunction("prompt", new Func<string, string, string>((m, d) => { popTurboString(); PromptDialog dlg = new PromptDialog(); dlg.PromptText = m; dlg.Value = d; dlg.messageBoxIcon = MessageBoxIcon.Question; return dlg.ShowDialog(this) == DialogResult.OK ? dlg.Value : d; })); FileIOFunctions.register(_engine, this); }
void showErrorDialog(string message) { PromptDialog dlg = new PromptDialog(); dlg.PromptText = message; dlg.isOKCancel = false; dlg.isPrompt = false; dlg.messageBoxIcon = MessageBoxIcon.Error; dlg.ShowDialog(this); }