private void button2_Click(object sender, EventArgs e) { try { dynamic model = new { UserID = 5016, IsAdmin = true, Name = "凯文" }; string dllPath = AppDomain.CurrentDomain.BaseDirectory + "dll/ddd.dll"; string html = KuRazor.GetRazorHtml <dynamic>(model, dllPath, true); MessageBox.Show(html); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } //try //{ // dynamic model = new { IsAdmin = true, Name = "name_1" }; // ITemplate instance = new KuRazorCommon.Dynamic.ddd(); // instance.SetModel(model); // using (var writer = new System.IO.StringWriter()) // { // instance.Run(writer); // string html = writer.ToString(); // } //} //catch (Exception ex) //{ // MessageBox.Show(ex.ToString()); //} }
private void Read_Click(object sender, EventArgs e) { try { dynamic model = new { UserID = 5016, IsAdmin = true, Name = "B" }; string dllPath = AppDomain.CurrentDomain.BaseDirectory + "dll/ddd.dll"; string html = KuRazor.GetRazorHtml <dynamic>(model, dllPath, true); MessageBox.Show(html); } catch (Exception ex) { MessageBox.Show(ex.ToString()); } }