Ejemplo n.º 1
0
        private void button1_Click(object sender, EventArgs e)
        {
            /*
             * Wb::Document doc=new mwg.Controls.WebBrowser.Document(this.webBrowser1.Document);
             * this.webBrowser1.Document.Write(doc.body.scrollTop.ToString());
             * //Wb::Window win=new Wb::Window(this.webBrowser1.Document.Window);
             * doc.body.attachEvent("onclick",delegate(){
             *      Forms::MessageBox.Show("This is C#!");
             *      return false;
             * });
             * //*/

            Wb::Window window = new Wb::Window(this.webBrowser1.Document.Window);

            window.document.body.onclick += delegate(){
                Forms::MessageBox.Show("Clicked!");
                return(false);
            };
            window.document.body.attachEvent("onclick", (System.Action <Wb::Event>) delegate(Wb::Event ev){
                Forms::MessageBox.Show(string.Format("Click ({0},{1})", ev.x, ev.y));
            });

#if DELEGTEST
            //Test - Delegate Export
            Wb::Window   window   = new Wb::Window(this.webBrowser1.Document.Window);
            Wb::Document document = new mwg.Controls.WebBrowser.Document(this.webBrowser1.Document);
            Wb::ScriptObject f = window.ToScriptObject((DRV) delegate(){
                Forms::MessageBox.Show("Hello!");
                return(100);
            });
            Wb::ScriptObject obj_win = window.ToScriptObject(window);
            obj_win["f"] = f;
            window.eval("alert(f());");
#endif

#if EXECTEST
            ExecTest test = new ExecTest();
            document.body.setAttribute("<mwg::init>", test, 0);
            window.execScript("document.body['<mwg::init>'].X(document.body['<mwg::init>']);");
            window.execScript("document.body['<mwg::init>'].getProp2=function(a,b,c){return this.Prop1*2;};", "javascript");
            // × window.execScript("var ret=document.body['<mwg::init>'].getProp2(1,2,3);alert(ret);","javascript");
            //window.execScript("var ret=document.body['<mwg::init>'].getProp2.apply(document.body['<mwg::init>'],[]);alert(ret);","javascript");
            //window.execScript("var proc=document.body['<mwg::init>'].getProp2;alert(proc.apply(document.body['<mwg::init>'],[]));","javascript");
#endif
        }
Ejemplo n.º 2
0
 public void X(ExecTest test)
 {
     Forms::MessageBox.Show("This is X(" + (test == null?"null":"test") + ")");
 }