/// <summary> /// 根据指定的上下文结构执行View渲染 /// </summary> /// <param name="js"></param> /// <param name="context"></param> /// <returns></returns> public string Render(string js, HostViewContext context) { var rtn = ""; try { var l = context.AllHostJsObject; List <KeyValuePair <string, object> > kvp = new List <KeyValuePair <string, object> >(); foreach (var item in l) { if (item.Name.ToLower() != "model") { kvp.Add(new KeyValuePair <string, object>(item.Name, item)); } } kvp.Add(new KeyValuePair <string, object>("model", context.CurrentModel)); context.CurrentHostJsEngine.Evaluate(js, kvp.ToArray()); rtn = ((ViewDocument)context.GetHostJsObject("viewdoc")).OutHtml(); } finally { context.CurrentHostJsEngine.Release(); } return(rtn); }
/// <summary> /// 获取控制台的信息 /// </summary> /// <returns></returns> public string GetConsoleMsg() { var c = (ConsoleObject)CurrentContext.GetHostJsObject(new ConsoleObject().Name); return(c.OutMsg); }