public ScriptView() { InitializeComponent(); TabText = "脚本"; Editor = JintCreator.CreateEditor(AppContext.Current); this.Controls.Add(Editor); }
static void textEditor_RunBefore(object sender, EventArgs e) { codeRichEditor textEditor = sender as codeRichEditor; JintEngine jint = textEditor.JintEngine; WatiN.Core.Browser browser = new BrowserWindow(context.Browser); jint.SetParameter("ie", new JsBrowser(browser)); jint.SetParameter("$", new Q(context, browser)); jint.SetFunction("getMapValue", new Jint.Delegates.Func <string, string>(getMapValue)); //jint.SetFunction("listprint", new Action<string>(listprint)); //jint.SetFunction("tableprint", new Action<string>(tableprint)); textEditor.FindForm().Tag = browser; }
static public codeRichEditor CreateEditor(IAppContext appcontext) { context = appcontext; JintEngine jint = JintCreator.Create(); codeRichEditor textEditor = new codeRichEditor(); textEditor.Browser = context.Browser; textEditor.JintEngine = jint; textEditor.Dock = DockStyle.Fill; textEditor.TmpRead(); textEditor.RunBefore += new EventHandler(textEditor_RunBefore); return(textEditor); }