protected void cmdTestAlert_Click ( object sender, EventArgs e ) { string result = string.Empty; Tracer tracer = new Tracer (); ScriptHelper scriptHelper = new ScriptHelper (); result += "测试方法 ScriptHelper.Alert(string)<br />"; foreach ( object code in tracer.Execute ( scriptHelper, null, "Alert", FunctionType.Method, new Type[] { typeof ( string ) }, null, null, null, new object[][] { new object[] { "'你好1'" }, new object[] { "'\"你好2\"'" } }, false ) ) result += "返回: " + code.ToString () + "<br />"; result += "测试方法 ScriptHelper.Alert(string, bool)<br />"; foreach ( object code in tracer.Execute ( scriptHelper, null, "Alert", FunctionType.Method, new Type[] { typeof ( string ), typeof ( bool ) }, null, null, null, new object[][] { new object[] { "'你好1, 追加? true'", true }, new object[] { "'\"你好2\", 追加? false'", false } }, false ) ) result += "返回: " + code.ToString () + "<br />"; result += "scriptHelper.Code = " + scriptHelper.Code + "<br />"; this.lblResult.Text = result; scriptHelper.Build ( this ); }
protected void cmdTestConstructor_Click ( object sender, EventArgs e ) { string result = string.Empty; Tracer tracer = new Tracer ( ); result += "测试构造函数 DW, 分别使用 空; ScriptType.JavaScript; ScriptType.VBScript;<br />"; foreach ( object core in tracer.Execute ( null, typeof ( DataWebCore<IDataWeb<PagerSetting>, PagerSetting> ), null, FunctionType.Constructor, null, null, null, null, new object[][] { new object[] { null, null } }, false ) ) result += "返回: " + core.ToString ( ) + "<br />"; this.lblResult.Text = result; }
protected void cmdTestConstructor_Click ( object sender, EventArgs e ) { string result = string.Empty; Tracer tracer = new Tracer (); result += "测试构造函数 ScriptHelper, 分别使用 空; ScriptType.JavaScript; ScriptType.VBScript;<br />"; foreach ( object scriptHelper in tracer.Execute ( null, typeof ( ScriptHelper ), null, FunctionType.Constructor, null, null, null, null, new object[][] { new object[] { }, new object[] { ScriptType.JavaScript }, new object[] { ScriptType.VBScript } }, false ) ) result += "返回: " + scriptHelper.ToString () + "<br />"; this.lblResult.Text = result; }
protected void cmdTestConstructor_Click ( object sender, EventArgs e ) { string result = string.Empty; Tracer tracer = new Tracer (); result += "测试构造函数 JQuery<br />"; foreach ( object jQuery in tracer.Execute ( null, typeof ( JQuery ), null, FunctionType.Constructor, null, null, null, null, new object[][] { new object[] { }, new object[] { false }, new object[] { "'body table'" }, new object[] { "'body table'", false }, new object[] { "'body table'", "document.body" }, new object[] { "'body table'", "document.body", false }, }, false ) ) result += "返回: " + jQuery.ToString () + "<br />"; this.lblResult.Text = result; }
protected void cmdTestRegisterArray_Click ( object sender, EventArgs e ) { string result = string.Empty; Tracer tracer = new Tracer (); result += "测试方法 RegisterArray(Page, string)<br />"; tracer.Execute ( null, typeof ( ScriptHelper ), "RegisterArray", FunctionType.Method, new Type[] { typeof ( Page ), typeof ( string ) }, null, null, null, new object[][] { new object[] { this, "mynames" }, new object[] { this, "myages" }, }, false ); result += "测试方法 RegisterArray(Page, string, string)<br />"; tracer.Execute ( null, typeof ( ScriptHelper ), "RegisterArray", FunctionType.Method, new Type[] { typeof ( Page ), typeof ( string ), typeof ( string ) }, null, null, null, new object[][] { new object[] { this, "myns", "'jack', 'tom'" }, new object[] { this, "myns", "'jack1', 'tom1'" } }, false ); this.lblResult.Text = result + "脚本, 请查看源文件<br />"; }
protected void cmdTestBuild_Click ( object sender, EventArgs e ) { string result = string.Empty; Tracer tracer = new Tracer (); ScriptHelper scriptHelper = new ScriptHelper (); result += "测试方法 ScriptHelper.Build(Page)<br />"; scriptHelper.Alert ( "'测试 Build 1'" ); tracer.Execute ( scriptHelper, null, "Build", FunctionType.Method, new Type[] { typeof ( Page ) }, null, null, null, new object[][] { new object[] { this } }, false ); result += "scriptHelper.Code = " + scriptHelper.Code + "<br />"; result += "测试方法 ScriptHelper.Build(Page, ScriptBuildOption)<br />"; scriptHelper.Clear (); scriptHelper.Alert ( "'测试 Build 2'" ); tracer.Execute ( scriptHelper, null, "Build", FunctionType.Method, new Type[] { typeof ( Page ), typeof ( ScriptBuildOption ) }, null, null, null, new object[][] { new object[] { this, ScriptBuildOption.OnlyCode } }, false ); result += "scriptHelper.Code = " + scriptHelper.Code + "<br />"; result += "测试方法 ScriptHelper.Build(Page, string)<br />"; scriptHelper.Clear (); scriptHelper.Alert ( "'测试 Build 3'" ); tracer.Execute ( scriptHelper, null, "Build", FunctionType.Method, new Type[] { typeof ( Page ), typeof ( string ) }, null, null, null, new object[][] { new object[] { this, "myscript" }, new object[] { this, "myscript" } }, false ); result += "scriptHelper.Code = " + scriptHelper.Code + "<br />"; result += "测试方法 ScriptHelper.Build(Page, string, ScriptBuildOption)<br />"; scriptHelper.Clear (); scriptHelper.Alert ( "'测试 Build 4'" ); tracer.Execute ( scriptHelper, null, "Build", FunctionType.Method, new Type[] { typeof ( Page ), typeof ( string ), typeof ( ScriptBuildOption ) }, null, null, null, new object[][] { new object[] { this, "myscript1", ScriptBuildOption.None }, new object[] { this, "myscript2", ScriptBuildOption.OnlyCode }, new object[] { this, "myscript3", ScriptBuildOption.Startup }, new object[] { this, "myscript3", ScriptBuildOption.Startup } }, false ); result += "scriptHelper.Code = " + scriptHelper.Code + "<br />"; this.lblResult.Text = result; }
protected void cmdTestClear_Click ( object sender, EventArgs e ) { string result = string.Empty; Tracer tracer = new Tracer (); ScriptHelper scriptHelper = new ScriptHelper (); result += "测试方法 ScriptHelper.Clear(string)<br />"; scriptHelper.Confirm ( "'有名字?'", "n" ); scriptHelper.Alert ( "'一句话'" ); tracer.Execute ( scriptHelper, null, "Clear", FunctionType.Method, null, null, null, null, new object[][] { new object[] { } }, false ); result += "scriptHelper.Code = " + scriptHelper.Code + "<br />"; this.lblResult.Text = result; scriptHelper.Build ( this ); }
protected void cmdTestAddClass_Click ( object sender, EventArgs e ) { string result = string.Empty; Tracer tracer = new Tracer (); JQuery jQuery = new JQuery ("'table'"); result += "测试方法 JQuery.AddClass(string)<br />"; tracer.Execute ( jQuery, null, "AddClass", FunctionType.Method, new Type[] { typeof ( string ) }, null, null, null, new object[][] { new object[] { "'box'" }, new object[] { "function(i, c){ return 'happy'; }" } }, false ); result += "jQuery.Code = " + jQuery.Code + "<br />"; this.lblResult.Text = result; jQuery.Build ( this, option: ScriptBuildOption.Startup ); }
protected void cmdTestConfirm_Click ( object sender, EventArgs e ) { string result = string.Empty; Tracer tracer = new Tracer (); ScriptHelper scriptHelper = new ScriptHelper (); result += "测试方法 ScriptHelper.Confirm(string)<br />"; foreach ( object code in tracer.Execute ( scriptHelper, null, "Confirm", FunctionType.Method, new Type[] { typeof ( string ) }, null, null, null, new object[][] { new object[] { "'确定1?'" }, new object[] { "'\"确定2?\"'" } }, false ) ) result += "返回: " + code.ToString () + "<br />"; result += "测试方法 ScriptHelper.Confirm(string, string)<br />"; foreach ( object code in tracer.Execute ( scriptHelper, null, "Confirm", FunctionType.Method, new Type[] { typeof ( string ), typeof ( string ) }, null, null, null, new object[][] { new object[] { "'确定? 返回结果到变量 c1'", "c1" }, new object[] { "'确定? 但没有返回到变量'", null } }, false ) ) result += "返回: " + code.ToString () + "<br />"; result += "测试方法 ScriptHelper.Confirm(string, bool)<br />"; foreach ( object code in tracer.Execute ( scriptHelper, null, "Confirm", FunctionType.Method, new Type[] { typeof ( string ), typeof ( bool ) }, null, null, null, new object[][] { new object[] { "'确定1? 追加? true'", true }, new object[] { "'\"确定2?\", 追加? false'", false } }, false ) ) result += "返回: " + code.ToString () + "<br />"; result += "测试方法 ScriptHelper.Confirm(string, string, bool)<br />"; foreach ( object code in tracer.Execute ( scriptHelper, null, "Confirm", FunctionType.Method, new Type[] { typeof ( string ), typeof ( string ), typeof ( bool ) }, null, null, null, new object[][] { new object[] { "'确定? 返回结果到变量 c1, 追加? true'", "c1", true }, new object[] { "'确定? 但没有返回到变量, 追加? false'", null, false } }, false ) ) result += "返回: " + code.ToString () + "<br />"; result += "scriptHelper.Code = " + scriptHelper.Code + "<br />"; this.lblResult.Text = result; scriptHelper.Build ( this ); }
protected void cmdTestRemoveAttr_Click ( object sender, EventArgs e ) { string result = string.Empty; Tracer tracer = new Tracer (); JQuery jQuery = new JQuery ( "'#myTable2'" ); result += "测试方法 JQuery.RemoveAttr(string)<br />"; tracer.Execute ( jQuery, null, "RemoveAttr", FunctionType.Method, new Type[] { typeof ( string ) }, null, null, null, new object[][] { new object[] { "'class'" } }, false ); result += "jQuery.Code = " + jQuery.Code + "<br />"; this.lblResult.Text = result; jQuery.Build ( this, option: ScriptBuildOption.Startup ); }
protected void cmdTestRegisterAttribute_Click ( object sender, EventArgs e ) { string result = string.Empty; Tracer tracer = new Tracer (); result += "测试方法 RegisterAttribute(Page, string, string, string)<br />"; tracer.Execute ( null, typeof ( ScriptHelper ), "RegisterAttribute", FunctionType.Method, new Type[] { typeof ( Page ), typeof ( string ), typeof ( string ), typeof ( string ) }, null, null, null, new object[][] { new object[] { this, "spanTest", "innerHTML", "点击我" }, new object[] { this, "spanTest", "style.color", "#ff0000" } }, false ); this.lblResult.Text = result + "脚本, 请查看源文件<br />"; }
protected void cmdTestSlice_Click ( object sender, EventArgs e ) { string result = string.Empty; Tracer tracer = new Tracer (); JQuery jQuery1 = new JQuery ( "'li'" ); JQuery jQuery2 = new JQuery ( "'li'" ); result += "测试方法 JQuery.Slice(string)<br />"; tracer.Execute ( jQuery1, null, "Slice", FunctionType.Method, new Type[] { typeof ( string ) }, null, null, null, new object[][] { new object[] { "2" } }, false ); result += "jQuery1.Code = " + jQuery1.AddClass ( "'big'" ).Code + "<br />"; result += "测试方法 JQuery.Slice(string, string)<br />"; tracer.Execute ( jQuery2, null, "Slice", FunctionType.Method, new Type[] { typeof ( string ), typeof ( string ) }, null, null, null, new object[][] { new object[] { "2", "4" } }, false ); result += "jQuery2.Code = " + jQuery2.AddClass ( "'happy'" ).Code + "<br />"; this.lblResult.Text = result; jQuery1.Build ( this, option: ScriptBuildOption.Startup ); jQuery2.Build ( this, option: ScriptBuildOption.Startup ); }
protected void cmdTestNot_Click ( object sender, EventArgs e ) { string result = string.Empty; Tracer tracer = new Tracer (); JQuery jQuery = new JQuery ( "'li'" ); result += "测试方法 JQuery.Not(string)<br />"; tracer.Execute ( jQuery, null, "Not", FunctionType.Method, new Type[] { typeof ( string ) }, null, null, null, new object[][] { new object[] { "':eq(0)'" } }, false ); result += "jQuery.Code = " + jQuery.AddClass ( "'big'" ).Code + "<br />"; this.lblResult.Text = result; jQuery.Build ( this, option: ScriptBuildOption.Startup ); }
protected void cmdTestMap_Click ( object sender, EventArgs e ) { string result = string.Empty; Tracer tracer = new Tracer (); JQuery jQuery = new JQuery ( "'li'" ); result += "测试方法 JQuery.Map(string)<br />"; tracer.Execute ( jQuery, null, "Map", FunctionType.Method, new Type[] { typeof ( string ) }, null, null, null, new object[][] { new object[] { "function(i, o){return alert($(this).text());}" } }, false ); result += "jQuery.Code = " + jQuery.Code + "<br />"; this.lblResult.Text = result; jQuery.Build ( this, option: ScriptBuildOption.Startup ); }
protected void cmdTestIs_Click ( object sender, EventArgs e ) { string result = string.Empty; Tracer tracer = new Tracer (); JQuery jQuery = new JQuery ( "'li'" ); result += "测试方法 JQuery.Is(string)<br />"; tracer.Execute ( jQuery, null, "Is", FunctionType.Method, new Type[] { typeof ( string ) }, null, null, null, new object[][] { new object[] { "'.happy'" } }, false ); result += "jQuery.Code = " + jQuery.Code + "<br />"; ScriptHelper scriptHelper = new ScriptHelper (); scriptHelper.Alert ( "'li is(.happay) = ' + " + jQuery.Code ); result += "scriptHelper.Code = " + scriptHelper.Code + "<br />"; this.lblResult.Text = result; scriptHelper.Build ( this, option: ScriptBuildOption.Startup ); }
protected void cmdTestCreate_Click ( object sender, EventArgs e ) { string result = string.Empty; Tracer tracer = new Tracer (); result += "测试方法 JQuery.Create()<br />"; foreach ( object jQuery in tracer.Execute ( null, typeof ( JQuery ), "Create", FunctionType.Method, new Type[] { }, null, null, null, new object[][] { new object[] { } }, false ) ) result += "返回: " + jQuery.ToString () + "<br />"; result += "测试方法 JQuery.Create(bool)<br />"; foreach ( object jQuery in tracer.Execute ( null, typeof ( JQuery ), "Create", FunctionType.Method, new Type[] { typeof ( bool ) }, null, null, null, new object[][] { new object[] { false } }, false ) ) result += "返回: " + jQuery.ToString () + "<br />"; result += "测试方法 JQuery.Create(string)<br />"; foreach ( object jQuery in tracer.Execute ( null, typeof ( JQuery ), "Create", FunctionType.Method, new Type[] { typeof ( string ) }, null, null, null, new object[][] { new object[] { "'table'" } }, false ) ) result += "返回: " + jQuery.ToString () + "<br />"; result += "测试方法 JQuery.Create(string, bool)<br />"; foreach ( object jQuery in tracer.Execute ( null, typeof ( JQuery ), "Create", FunctionType.Method, new Type[] { typeof ( string ), typeof ( bool ) }, null, null, null, new object[][] { new object[] { "'table'", false } }, false ) ) result += "返回: " + jQuery.ToString () + "<br />"; result += "测试方法 JQuery.Create(string, string)<br />"; foreach ( object jQuery in tracer.Execute ( null, typeof ( JQuery ), "Create", FunctionType.Method, new Type[] { typeof ( string ), typeof ( string ) }, null, null, null, new object[][] { new object[] { "'table'", "document.body" } }, false ) ) result += "返回: " + jQuery.ToString () + "<br />"; result += "测试方法 JQuery.Create(string, string, bool)<br />"; foreach ( object jQuery in tracer.Execute ( null, typeof ( JQuery ), "Create", FunctionType.Method, new Type[] { typeof ( string ), typeof ( string ), typeof ( bool ) }, null, null, null, new object[][] { new object[] { "'table'", "document.body", false } }, false ) ) result += "返回: " + jQuery.ToString () + "<br />"; this.lblResult.Text = result; }
protected void cmdTestVal_Click ( object sender, EventArgs e ) { string result = string.Empty; Tracer tracer = new Tracer (); JQuery jQuery1 = new JQuery ( "'#myTextBox1'" ); JQuery jQuery2 = new JQuery ( jQuery1 ); result += "测试方法 JQuery.Val()<br />"; tracer.Execute ( jQuery1, null, "Val", FunctionType.Method, new Type[] { }, null, null, null, new object[][] { new object[] { } }, false ); result += "jQuery1.Code = " + jQuery1.Code + "<br />"; result += "测试方法 JQuery.Val(string)<br />"; tracer.Execute ( jQuery2, null, "Val", FunctionType.Method, new Type[] { typeof ( string ) }, null, null, null, new object[][] { new object[] { "'jack'" } }, false ); result += "jQuery2.Code = " + jQuery2.Code + "<br />"; ScriptHelper scriptHelper = new ScriptHelper (); scriptHelper.Alert ( "'myTextBox1.value = ' + " + jQuery1.Code ); result += "scriptHelper.Code = " + scriptHelper.Code + "<br />"; this.lblResult.Text = result; scriptHelper.Build ( this, option: ScriptBuildOption.Startup ); jQuery2.Build ( this, option: ScriptBuildOption.Startup ); }
protected void cmdTestRegisterInclude_Click ( object sender, EventArgs e ) { string result = string.Empty; Tracer tracer = new Tracer (); result += "测试方法 RegisterInclude(Page, string)<br />"; tracer.Execute ( null, typeof ( ScriptHelper ), "RegisterInclude", FunctionType.Method, new Type[] { typeof ( Page ), typeof ( string ) }, null, null, null, new object[][] { new object[] { this, "~/test.js" } }, false ); result += "测试方法 RegisterInclude(Page, string, string)<br />"; tracer.Execute ( null, typeof ( ScriptHelper ), "RegisterInclude", FunctionType.Method, new Type[] { typeof ( Page ), typeof ( string ), typeof ( string ) }, null, null, null, new object[][] { new object[] { this, "test1", "http://www.google.com/test.js" }, new object[] { this, "test1", "http://www.google.com/test.js" } }, false ); this.lblResult.Text = result + "脚本, 请查看源文件<br />"; }
protected void cmdTestRegisterSubmit_Click ( object sender, EventArgs e ) { string result = string.Empty; Tracer tracer = new Tracer (); result += "测试方法 RegisterSubmit(Page, string, string)<br />"; tracer.Execute ( null, typeof ( ScriptHelper ), "RegisterSubmit", FunctionType.Method, new Type[] { typeof ( Page ), typeof ( string ), typeof ( string ) }, null, null, null, new object[][] { new object[] { this, "s1", "alert('OK1!');" }, new object[] { this, "s1", "alert('OK2!');" }, new object[] { this, "s2", "alert('OK3!');" } }, false ); this.lblResult.Text = result + "请点击\"填好了!\"按钮, 脚本, 请查看源文件<br />"; }
protected void cmdTestClearTimeout_Click ( object sender, EventArgs e ) { string result = string.Empty; Tracer tracer = new Tracer (); ScriptHelper scriptHelper = new ScriptHelper (); result += "测试方法 ScriptHelper.ClearTimeout(string)<br />"; scriptHelper.SetInterval ( "'alert(\"句柄 timer1\");'", 5000, "timer1" ); foreach ( object code in tracer.Execute ( scriptHelper, null, "ClearTimeout", FunctionType.Method, new Type[] { typeof ( string ) }, null, null, null, new object[][] { new object[] { "timer1" }, }, false ) ) result += "返回: " + code.ToString () + "<br />"; result += "测试方法 ScriptHelper.ClearTimeout(string, bool)<br />"; scriptHelper.SetInterval ( "'alert(\"句柄 timer2\");'", 5000, "timer2" ); foreach ( object code in tracer.Execute ( scriptHelper, null, "ClearTimeout", FunctionType.Method, new Type[] { typeof ( string ), typeof ( bool ) }, null, null, null, new object[][] { new object[] { "timer2", false } }, false ) ) result += "返回: " + code.ToString () + "<br />"; result += "scriptHelper.Code = " + scriptHelper.Code + "<br />"; this.lblResult.Text = result; scriptHelper.Build ( this ); }
protected void cmdTestRegisterHidden_Click ( object sender, EventArgs e ) { string result = string.Empty; Tracer tracer = new Tracer (); result += "测试方法 RegisterHidden(Page, string, string)<br />"; tracer.Execute ( null, typeof ( ScriptHelper ), "RegisterHidden", FunctionType.Method, new Type[] { typeof ( Page ), typeof ( string ), typeof ( string ) }, null, null, null, new object[][] { new object[] { this, "hidden1", "1" }, new object[] { this, "hidden1", "2" }, new object[] { this, "hidden2", null } }, false ); this.lblResult.Text = result + "脚本, 请查看源文件<br />"; }
protected void cmdTestAttr_Click ( object sender, EventArgs e ) { string result = string.Empty; Tracer tracer = new Tracer (); JQuery jQuery1 = new JQuery ( "'#myTable1'" ); JQuery jQuery2 = new JQuery ( "'#myTable2'" ); result += "测试方法 JQuery.Attr(string)<br />"; tracer.Execute ( jQuery1, null, "Attr", FunctionType.Method, new Type[] { typeof ( string ) }, null, null, null, new object[][] { new object[] { "{ border: '1' }" }, new object[] { "'style'" } }, false ); result += "jQuery1.Code = " + jQuery1.Code + "<br />"; result += "测试方法 JQuery.Attr(string, string)<br />"; tracer.Execute ( jQuery2, null, "Attr", FunctionType.Method, new Type[] { typeof ( string ), typeof ( string ) }, null, null, null, new object[][] { new object[] { "'border'", "'1'" }, new object[] { "'style'", "function(i, a){ return 'width: 700px'; }" } }, false ); result += "jQuery2.Code = " + jQuery2.Code + "<br />"; this.lblResult.Text = result; jQuery1.Build ( this, option: ScriptBuildOption.Startup ); jQuery2.Build ( this, option: ScriptBuildOption.Startup ); }
protected void cmdTestSetTimeout_Click ( object sender, EventArgs e ) { string result = string.Empty; Tracer tracer = new Tracer (); ScriptHelper scriptHelper = new ScriptHelper (); result += "测试方法 ScriptHelper.SetTimeout(string, int)<br />"; foreach ( object code in tracer.Execute ( scriptHelper, null, "SetTimeout", FunctionType.Method, new Type[] { typeof ( string ), typeof ( int ) }, null, null, null, new object[][] { new object[] { "'alert(\"hello, 5 秒钟触发\")'", 5000 }, new object[] { "function(){alert('函数方式触发, 5 秒钟触发');}", 5000 } }, false ) ) result += "返回: " + code.ToString () + "<br />"; result += "测试方法 ScriptHelper.SetTimeout(string, int, string)<br />"; foreach ( object code in tracer.Execute ( scriptHelper, null, "SetTimeout", FunctionType.Method, new Type[] { typeof ( string ), typeof ( int ), typeof ( string ) }, null, null, null, new object[][] { new object[] { "'alert(\"hello, 20 秒钟触发, 句柄保存到 timer1\")'", 20000, "timer1" }, new object[] { "function(){alert('函数方式触发, 20 秒钟触发, 句柄保存到 timer2');}", 20000, "timer2" } }, false ) ) result += "返回: " + code.ToString () + "<br />"; result += "测试方法 ScriptHelper.SetTimeout(string, int, bool)<br />"; foreach ( object code in tracer.Execute ( scriptHelper, null, "SetTimeout", FunctionType.Method, new Type[] { typeof ( string ), typeof ( int ), typeof ( bool ) }, null, null, null, new object[][] { new object[] { "'alert(\"hello, 5 秒钟触发, 不追加\")'", 5000, false }, new object[] { "function(){alert('函数方式触发, 5 秒钟触发, 不追加');}", 5000, false } }, false ) ) result += "返回: " + code.ToString () + "<br />"; result += "测试方法 ScriptHelper.SetTimeout(string, int, string, bool)<br />"; foreach ( object code in tracer.Execute ( scriptHelper, null, "SetTimeout", FunctionType.Method, new Type[] { typeof ( string ), typeof ( int ), typeof ( string ), typeof ( bool ) }, null, null, null, new object[][] { new object[] { "'alert(\"hello, 20 秒钟触发, 句柄保存到 timer1, 不追加\")'", 20000, "timer1", false }, new object[] { "function(){alert('函数方式触发, 20 秒钟触发, 句柄保存到 timer2, 不追加');}", 20000, "timer2", false } }, false ) ) result += "返回: " + code.ToString () + "<br />"; result += "scriptHelper.Code = " + scriptHelper.Code + "<br />"; this.lblResult.Text = result; scriptHelper.Build ( this ); }
protected void cmdTestNavigate_Click ( object sender, EventArgs e ) { string result = string.Empty; Tracer tracer = new Tracer (); ScriptHelper scriptHelper = new ScriptHelper (); /* result += "测试方法 ScriptHelper.Navigate(string)<br />"; tracer.Execute ( scriptHelper, null, "Navigate", FunctionType.Method, new Type[] { typeof ( string ) }, null, null, null, new object[][] { new object[] { "'http://www.google.com/'" } }, false ); */ result += "测试方法 ScriptHelper.Navigate(string, NavigateOption)<br />"; foreach ( object code in tracer.Execute ( scriptHelper, null, "Navigate", FunctionType.Method, new Type[] { typeof ( string ), typeof ( NavigateOption ) }, null, null, null, new object[][] { new object[] { "'http://www.google.com/'", NavigateOption.NewWindow }, new object[] { "'http://www.google.com/'", NavigateOption.SelfWindow } }, false ) ) result += "返回: " + code.ToString () + "<br />"; result += "测试方法 ScriptHelper.Navigate(string, NavigateOption, bool)<br />"; foreach ( object code in tracer.Execute ( scriptHelper, null, "Navigate", FunctionType.Method, new Type[] { typeof ( string ), typeof ( NavigateOption ), typeof ( bool ) }, null, null, null, new object[][] { new object[] { "'http://www.google.com/'", NavigateOption.NewWindow, true }, new object[] { "'http://www.google.com/'", NavigateOption.SelfWindow, false } }, false ) ) result += "返回: " + code.ToString () + "<br />"; result += "scriptHelper.Code = " + scriptHelper.Code + "<br />"; this.lblResult.Text = result; scriptHelper.Build ( this ); }
protected void cmdTestMakeKey_Click ( object sender, EventArgs e ) { string result = string.Empty; Tracer tracer = new Tracer (); result += "测试方法 ScriptHelper.MakeKey()<br />"; foreach ( object key in tracer.Execute ( null, typeof ( ScriptHelper ), "MakeKey", FunctionType.Method, new Type[] { }, null, null, null, new object[][] { new object[] { }, }, false ) ) result += "返回: " + key.ToString () + "<br />"; result += "测试方法 ScriptHelper.MakeKey(string)<br />"; foreach ( object key in tracer.Execute ( null, typeof ( ScriptHelper ), "MakeKey", FunctionType.Method, new Type[] { typeof ( string ) }, null, null, null, new object[][] { new object[] { "testKey" } }, false ) ) result += "返回: " + key.ToString () + "<br />"; this.lblResult.Text = result; }
protected void cmdTestAppendScript_Click ( object sender, EventArgs e ) { string result = string.Empty; Tracer tracer = new Tracer (); ScriptHelper scriptHelper = new ScriptHelper (); result += "测试方法 ScriptHelper.AppendScript(string)<br />"; scriptHelper.Confirm ( "'有名字?'", "n" ); tracer.Execute ( scriptHelper, null, "AppendScript", FunctionType.Method, new Type[] { typeof ( string ) }, null, null, null, new object[][] { new object[] { "if(n){n = '有名字';}else{n = '没有名字';}" } }, false ); scriptHelper.Alert ( "'名字? ' + n" ); result += "scriptHelper.Code = " + scriptHelper.Code + "<br />"; this.lblResult.Text = result; scriptHelper.Build ( this ); }
public void TestExecute ( ) { Console.WriteLine ( "测试方法 Execute(object, Type, string, FunctionType, Type[], string, string, string, object[][], bool)" ); try { Student jack = new Student ( "jack", 10 ); Student tom = new Student ( "tom", 9 ); Tracer tracer = new Tracer ( ); tracer.Execute ( jack, null, "GoToSchool", FunctionType.Method, null, null, null, null, new object[][] { new object[] { } }, true ); Console.WriteLine ( "成功: Execute(jack, null, \"GoToSchool\", FunctionType.Method, null, null, null, null, new object[][] { new object[] { } }, true)" ); foreach ( object result in tracer.Execute ( jack, null, "SetName", FunctionType.Method, null, "姓名: {0}", "返回: {0}", "是否测试 SetName ?", new object[][] { new object[] { "jack2" }, new object[] { "jack3" } }, false ) ) Console.WriteLine ( result ); Console.WriteLine ( "成功: Execute(jack, null, \"SetName\", FunctionType.Method, null, \"姓名: <0>\", \"返回: <0>\", \"是否测试 SetName ?\", new object[][] { new object[] { \"jack2\" }, new object[] { \"jack3\" } }, false)" ); foreach ( object result in tracer.Execute ( jack, null, "GetName", FunctionType.Method, new Type[] { }, null, "返回: {0}", null, new object[][] { new object[] { }, new object[] { } }, true ) ) Console.WriteLine ( result ); Console.WriteLine ( "成功: Execute(jack, null, \"GetName\", FunctionType.Method, new Type[] { }, null, \"返回: <0>\", null, new object[][] { new object[] { }, new object[] { } }, true)" ); foreach ( object result in tracer.Execute ( jack, null, "GetName", FunctionType.Method, new Type[] { typeof ( int ) }, null, "返回: {0}", null, new object[][] { new object[] { 1 }, new object[] { 2 } }, true ) ) Console.WriteLine ( result ); Console.WriteLine ( "成功: Execute(jack, null, \"GetName\", FunctionType.Method, new Type[] { typeof(int) }, null, \"返回: <0>\", null, new object[][] { new object[] { 1 }, new object[] { 2 } }, true)" ); foreach ( object result in tracer.Execute ( null, typeof ( Student ), null, FunctionType.Constructor, null, "姓名: {0}, 年龄: {1}", "返回: {0}", null, new object[][] { new object[] { "lili", 11 }, new object[] { string.Empty, 12 } }, true ) ) Console.WriteLine ( result ); Console.WriteLine ( "成功: Execute(null, typeof(Student), null, FunctionType.Constructor, null, \"姓名: <0>, 年龄: <1>\", \"返回: <0>\", null, new object[][] { new object[] { \"lili\", 11 }, new object[] { \"lucy\", 11 } }, true)" ); tracer.Execute ( null, typeof ( Student ), "Print", FunctionType.Method, null, null, null, null, new object[][] { new object[] { jack }, new object[] { tom } }, false ); Console.WriteLine ( "成功: Execute(null, typeof(Student), \"Print\", FunctionType.Method, null, null, null, null, new object[][] { new object[] { jack }, new object[] { tom } }, false)" ); } catch ( Exception err ) { Console.WriteLine ( string.Format ( "异常: {0}", err.Message ) ); } Console.WriteLine ( "请按回车键继续..." ); Console.ReadLine ( ); }
protected void cmdTestEndLine_Click ( object sender, EventArgs e ) { string result = string.Empty; Tracer tracer = new Tracer (); JQuery jQuery = new JQuery ( "'table'" ); result += "测试方法 jQuery.EndLine()<br />"; foreach ( object newJQuery in tracer.Execute ( jQuery, null, "EndLine", FunctionType.Method, new Type[] { }, null, null, null, new object[][] { new object[] { } }, false ) ) result += "newJQuery.Code = " + ( newJQuery as JQuery ).Code + "<br />"; this.lblResult.Text = result; }