コード例 #1
0
ファイル: WatinDriver.cs プロジェクト: hillsoul/MvcContrib
        private static PropertyInfo GetOrCreateProperty(IExpando expando, string name)
        {
            PropertyInfo property = expando.GetProperty(name, BindingFlags.Instance);
            if (property == null)
                property = expando.AddProperty(name);

            return property;
        }
コード例 #2
0
 public static object GetField(this IExpando exp, object key) // caller to this func must restore the lua-stack's top after calling this func.
 {
     if (exp != null && key != null)
     {
         using (var ex = exp.Extra)
         {
             if (ex != null)
             {
                 object obj;
                 if (ex.TryGetValue(key, out obj))
                 {
                     return(obj);
                 }
             }
             if (exp.Core != null)
             {
                 return(exp.Core[key]);
             }
         }
     }
     return(null);
 }
コード例 #3
0
        public void OnDocumentComplete(object pDisp, ref object URL)
        {
            HTMLDocument document = (HTMLDocument)webBrowser.Document;

            dynamic      window       = document.parentWindow;
            IExpando     ScriptObject = (IExpando)window;
            PropertyInfo btnEvent     = ScriptObject.GetProperty("toQt", BindingFlags.Default);

            if (btnEvent == null)
            {
                btnEvent = ScriptObject.AddProperty("toQt");
            }
            btnEvent.SetValue(ScriptObject, this, null);

            IHTMLElement head = (IHTMLElement)((IHTMLElementCollection)
                                               document.all.tags("head")).item(null, 0);

            IHTMLScriptElement scriptObject =
                (IHTMLScriptElement)document.createElement("script");

            scriptObject.type = @"text/javascript";
            scriptObject.text = "var myEles = document.getElementById('su'); if(myEles != undefined && myEles != null) {myEles.onmouseup=aaa;function aaa(){window.toQt.sendMsgToQt('hahaha')}}";
            ((HTMLHeadElement)head).appendChild((IHTMLDOMNode)scriptObject);
        }
コード例 #4
0
 private WindowsScriptItem(WindowsScriptEngine engine, IExpando target)
 {
     this.engine = engine;
     this.target = target;
 }
コード例 #5
0
 private WindowsScriptItem(WindowsScriptEngine engine, IExpando target)
 {
     this.engine = engine;
        this.target = target;
 }
コード例 #6
0
        public void OnDocumentComplete(object pDisp, ref object URL)
        {
            /*
             *
             * HTMLDocument document = (HTMLDocument)webBrowser.Document;
             *
             * dynamic window = document.parentWindow;
             * IExpando ScriptObject = (IExpando)window;
             * PropertyInfo btnEvent = ScriptObject.GetProperty("toQt", BindingFlags.Default);
             * if (btnEvent == null) btnEvent = ScriptObject.AddProperty("toQt");
             * btnEvent.SetValue(ScriptObject, this, null);
             *
             * IHTMLElement head = (IHTMLElement)((IHTMLElementCollection)
             *                      document.all.tags("head")).item(null, 0);
             *
             * IHTMLScriptElement scriptObject =
             *  (IHTMLScriptElement)document.createElement("script");
             * scriptObject.type = @"text/javascript";
             * //scriptObject.text = "var myEles = document.getElementById('su'); var kw=document.getElementById('kw').value; if(myEles != undefined && myEles != null) {myEles.onmouseup=aaa(kw);function aaa(kw){window.toQt.sendMsgToQt('www.3dy.com ; '+kw)}}";
             * scriptObject.text = "var myEles = document.getElementById('su'); if(myEles != undefined && myEles != null) {myEles.onmouseup=aaa;function aaa(){window.toQt.sendMsgToQt('hahaha')}}";
             *
             * ((HTMLHeadElement)head).appendChild((IHTMLDOMNode)scriptObject);
             */
            HTMLDocument document = (HTMLDocument)webBrowser.Document;

            dynamic      window       = document.parentWindow;
            IExpando     ScriptObject = (IExpando)window;
            PropertyInfo btnEvent     = ScriptObject.GetProperty("toQt", BindingFlags.Default);

            if (btnEvent == null)
            {
                btnEvent = ScriptObject.AddProperty("toQt");
            }
            btnEvent.SetValue(ScriptObject, this, null);

            IHTMLElement head = (IHTMLElement)((IHTMLElementCollection)
                                               document.all.tags("head")).item(null, 0);

            IHTMLScriptElement scriptObject =
                (IHTMLScriptElement)document.createElement("script");

            scriptObject.type = @"text/javascript";
            //scriptObject.text = "var myEles = document.getElementById('su'); var kw=document.getElementById('kw').value; if(myEles != undefined && myEles != null) {myEles.onmouseup=aaa(kw);function aaa(kw){window.toQt.sendMsgToQt('www.3dy.com ; '+kw)}}";
            //scriptObject.text = "var myEles = document.getElementById('su'); if(myEles != undefined && myEles != null) {myEles.valuvalu";
            //scriptObject.text = "var data={'aa':document.getElementById('names')};$.ajax({type: 'POST',url: 'http://127.0.0.1:8000/opendata/test/',contentType: 'application/json;charset=utf-8',dataType: 'json',data: JSON.stringify(data),success: function (data) {  console.log(data);})";
            //scriptObject.text = "  $('#btnQuery').click(function(){var trs=document.querySelectorAll('tr.DataGridItem');var keys=['流水号','处方号','姓名','病历号','看诊医生','看诊时间','是否已发药','发药时间','发药人员','处方(含耗材)金额','退药'];var data=[];for(var i=0;i<trs.length;i++){tds=trs[i].querySelectorAll('td');var item={};item={'流水号':tds[0].innerText,'处方号':tds[1].innerText,'姓名':tds[2].innerText,'病历号':tds[3].innerText,'看诊医生':tds[4].innerText,'看诊时间':tds[5].innerText,'是否已发药':tds[6].innerText,'发药时间':tds[7].innerText,'发药人员':tds[8].innerText,'处方(含耗材)金额':tds[9].innerText};data.push(item)};$.ajax({type:'POST',url:'http://121.204.198.52:8809/v13/opendata/test/',contentType:'application/json;charset=utf-8',dataType:'json',data:JSON.stringify(data),success:function(data){}})});";
            //scriptObject.text = "  $('#btnQuery').click(function(){var trs=document.querySelectorAll('tr.DataGridItem');var keys=['流水号','处方号','姓名','病历号','看诊医生','看诊时间','是否已发药','发药时间','发药人员','处方(含耗材)金额','退药'];var data=[];for(var i=0;i<trs.length;i++){tds=trs[i].querySelectorAll('td');var item={};item={'流水号':tds[0].innerText,'处方号':tds[1].innerText,'姓名':tds[2].innerText,'病历号':tds[3].innerText,'看诊医生':tds[4].innerText,'看诊时间':tds[5].innerText,'是否已发药':tds[6].innerText,'发药时间':tds[7].innerText,'发药人员':tds[8].innerText,'处方(含耗材)金额':tds[9].innerText};data.push(item)};$.ajax({type:'POST',url:'http://121.204.198.52:8809/v13/opendata/test/',contentType:'application/json;charset=utf-8',dataType:'json',data:JSON.stringify(data),success:function(data){}})});";
            //scriptObject.text = "  $('#btnQuery').click(var data={'tttt':'3dy.me'};$.ajax({type:'POST',url:'http://121.204.198.52:8809/v13/opendata/test/',contentType:'application/json;charset=utf-8',dataType:'json',data:JSON.stringify(data),success:function(data){}})});";
            //scriptObject.text = "  $('#btnQuery').click(var data={'tttt':'3dy.me'};$.ajax({type:'POST',url:'http://121.204.198.52:8809/v13/opendata/test/',contentType:'application/json;charset=utf-8',dataType:'json',data:JSON.stringify(data),success:function(data){}})});";
            //scriptObject.text = "  $(window.parent.frames['ifWorkFrame'].document).find('input#btnQuery').click(function(){alert('aa')})";
            //document.getElementById(id).contentDocument
            //scriptObject.text = "  $('#input').click(function(){alert('aa')})";


            //病人取药的tables
            //window.frames[2].frames[0].document.getElementById("gvInfo").innerText
            //查询按钮
            //window.frames[2].frames[0].document.getElementById("btnQuery").value

            scriptObject.text = "window.frames[2].frames[0].document.getElementById('btnQuery').onmousemove = function(){alert('aa');}";
            ((HTMLHeadElement)head).appendChild((IHTMLDOMNode)scriptObject);

            /*
             * string aa = "{\"hello\":\"C#  mircosoft.....\"}";
             * string msg= "{\"hello\":\"C#  mircosoft.....\"}";
             * //http://127.0.0.1:8000/opendata/test/
             * //http://121.204.198.52:8809/v13/opendata/test/
             * WebRequest request = WebRequest.Create("http://121.204.198.52:8809/v13/opendata/test/");
             * request.Method = "POST";
             * request.ContentType = "application/json";
             * byte[] buf = Encoding.UTF8.GetBytes(aa);
             * byte[] byteArray = System.Text.Encoding.Default.GetBytes(aa);
             * request.ContentLength = Encoding.UTF8.GetByteCount(aa);
             * request.GetRequestStream().Write(buf, 0, buf.Length);
             * WebResponse response = request.GetResponse();
             * Stream myResponseStream = response.GetResponseStream();
             * StreamReader myStreamReader = new StreamReader(myResponseStream, Encoding.GetEncoding("utf-8"));
             * string retString = myStreamReader.ReadToEnd();
             * myStreamReader.Close();
             * myResponseStream.Close();
             */
        }
コード例 #7
0
 public Expando(object expando)
 {
     Object    = expando;
     AsExpando = (IExpando)expando;
 }
コード例 #8
0
ファイル: IExpandoExtension.cs プロジェクト: cnboker/autorobo
        public static int GetInt(this IExpando expando, string key)
        {
            var val = GetValue(expando, key);

            return(val == null ? 0 : Convert.ToInt32(val));
        }
コード例 #9
0
        private static PropertyInfo CreateOrGetProperty(IExpando expando, string name)
        {
            var currentProperty = expando.GetProperty(name, BindingFlags.GetProperty);

            return(currentProperty ?? expando.AddProperty(name));
        }
コード例 #10
0
 public static object GetValue(this IExpando instance, string propertyName)
 {
     return(Invoke(instance, propertyName, InvokeFlags.DISPATCH_PROPERTYGET, new object[0]));
 }
コード例 #11
0
 public DynamicNode(IExpando value)
 {
     this.value = value;
 }
コード例 #12
0
ファイル: IExpandoExtension.cs プロジェクト: cnboker/autorobo
        public static DateTime GetDate(this IExpando expando, string key)
        {
            var val = GetValue(expando, key);

            return(val == null ? DateTime.MinValue : Convert.ToDateTime(val));
        }
コード例 #13
0
ファイル: IExpandoExtension.cs プロジェクト: cnboker/autorobo
        public static string GetString(this IExpando expando, string key)
        {
            var val = GetValue(expando, key);

            return(val == null ? "" : val.ToString());
        }
コード例 #14
0
ファイル: IExpandoExtension.cs プロジェクト: cnboker/autorobo
        public static bool GetBoolean(this IExpando expando, string key)
        {
            var val = GetValue(expando, key);

            return(val == null ? false : Convert.ToBoolean(val));
        }
コード例 #15
0
ファイル: BHO.cs プロジェクト: robber2000/icaller
        public void OnDocumentComplete(object pDisp, ref object URL)
        {
            HTMLDocument document     = (HTMLDocument)webBrowser.Document;
            dynamic      window       = document.parentWindow;
            IExpando     ScriptObject = (IExpando)window;
            PropertyInfo btnEvent     = ScriptObject.GetProperty("toQt", BindingFlags.Default);

            if (btnEvent == null)
            {
                btnEvent = ScriptObject.AddProperty("toQt");
            }
            btnEvent.SetValue(ScriptObject, this, null);
            IHTMLElement head = (IHTMLElement)((IHTMLElementCollection)
                                               document.all.tags("head")).item(null, 0);
            IHTMLScriptElement scriptObject = (IHTMLScriptElement)document.createElement("script");

            scriptObject.type = @"text/javascript";
            //scriptObject.text = "alert('aa')";
            //scriptObject.text = "var myEles = document.getElementById('su'); if(myEles != undefined && myEles != null) {myEles.valuvalu";
            //scriptObject.text = "var data={'aa':document.getElementById('names')};$.ajax({type: 'POST',url: 'http://127.0.0.1:8000/opendata/test/',contentType: 'application/json;charset=utf-wind8',dataType: 'json',data: JSON.stringify(data),success: function (data) {  console.log(data);})";
            //scriptObject.text = "  $('#btnQuery').click(function(){var trs=document.querySelectorAll('tr.DataGridItem');var keys=['流水号','处方号','姓名','病历号','看诊医生','看诊时间','是否已发药','发药时间','发药人员','处方(含耗材)金额','退药'];var data=[];for(var i=0;i<trs.length;i++){tds=trs[i].querySelectorAll('td');var item={};item={'流水号':tds[0].innerText,'处方号':tds[1].innerText,'姓名':tds[2].innerText,'病历号':tds[3].innerText,'看诊医生':tds[4].innerText,'看诊时间':tds[5].innerText,'是否已发药':tds[6].innerText,'发药时间':tds[7].innerText,'发药人员':tds[8].innerText,'处方(含耗材)金额':tds[9].innerText};data.push(item)};$.ajax({type:'POST',url:'http://121.204.198.52:8809/v13/opendata/test/',contentType:'application/json;charset=utf-8',dataType:'json',data:JSON.stringify(data),success:function(data){}})});";
            //scriptObject.text = "  $('#btnQuery').click(function(){var trs=document.querySelectorAll('tr.DataGridItem');var keys=['流水号','处方号','姓名','病历号','看诊医生','看诊时间','是否已发药','发药时间','发药人员','处方(含耗材)金额','退药'];var data=[];for(var i=0;i<trs.length;i++){tds=trs[i].querySelectorAll('td');var item={};item={'流水号':tds[0].innerText,'处方号':tds[1].innerText,'姓名':tds[2].innerText,'病历号':tds[3].innerText,'看诊医生':tds[4].innerText,'看诊时间':tds[5].innerText,'是否已发药':tds[6].innerText,'发药时间':tds[7].innerText,'发药人员':tds[8].innerText,'处方(含耗材)金额':tds[9].innerText};data.push(item)};$.ajax({type:'POST',url:'http://121.204.198.52:8809/v13/opendata/test/',contentType:'application/json;charset=utf-8',dataType:'json',data:JSON.stringify(data),success:function(data){}})});";
            //scriptObject.text = "  $('#btnQuery').click(var data={'tttt':'3dy.me'};$.ajax({type:'POST',url:'http://121.204.198.52:8809/v13/opendata/test/',contentType:'application/json;charset=utf-8',dataType:'json',data:JSON.stringify(data),success:function(data){}})});";
            //scriptObject.text = "  $('#btnQuery').click(var data={'tttt':'3dy.me'};$.ajax({type:'POST',url:'http://121.204.198.52:8809/v13/opendata/test/',contentType:'application/json;charset=utf-8',dataType:'json',data:JSON.stringify(data),success:function(data){}})});";
            //scriptObject.text = "  $(window.parent.frames['ifWorkFrame'].document).find('input#btnQuery').click(function(){alert('aa')})";
            //document.getElementById(id).contentDocument
            //scriptObject.text = "  $('#input').click(function(){alert('aa')})";
            //通知栏所在区域,打开区域
            //window.parent.document.getElementsByTagName('frameset')[2].setAttribute('rows', '105,*')
            //病人取药的tables
            //window.frames[2].frames[0].document.getElementById("gvInfo").innerText
            //查询按钮
            //window.frames[2].frames[0].document.getElementById("btnQuery").value

            //发药按钮(详情页内)
            //btnFayao window.frames[2].frames[0].document.getElementById("btnFayao")
            //  病人信息,名字,性别,年龄
            //病人信息(详情页内)
            //var tab = window.frames[2].frames[0].document.getElementById("tbPatient").rows[0].cells[5].innerHTML.split(" ")[0];


            //table.row[1].cells[10].onmouseover = function(){ alert("ss")}
            //}
            //测试调用自定义的DLL window.toQt.ie_add(99,100)+''
            // scriptObject.text = "var myEles = document.getElementById('su'); var kw=document.getElementById('kw').value ; myEles.onclick=aaa(kw);function aaa(kw){alert(window.toQt.ie_add(99,100));}";
            //scriptObject.text = "var sub = window.frames[1].document.getElementById('td_left');";
            //scriptObject.text += "var card=document.createElement('div');card.style.height='200px';card.style.width='200px';card.style.backgroundColor='#007fbb';card.style.setAttribute('position','absolute');card.style.left='20px';card.style.top='30px';sub.appendChild(card);var title=document.createElement('div');title.style.setAttribute('position','absolute');title.style.left='5%';title.style.width='55%';title.style.height='50px';title.style.paddingLeft='35%';title.style.fontSize='36px';title.style.marginTop='30px';title.style.color='#fff';title.style.borderBottom='1px solid #fff';title.innerText='18';card.appendChild(title);var man=document.createElement('div');man.style.setAttribute('position','absolute');man.style.top='100px';man.style.left='5%';man.style.width='55%';man.style.height='50px';man.style.paddingLeft='18%';man.style.fontSize='36px';man.style.color='#fff';man.innerText='马若莉';card.appendChild(man);";
            //scriptObject.text += "var sub=document.createElement('div');sub.style.height='105px';sub.style.width='1000px';sub.style.backgroundColor='#ededed';document.getElementById('sub').appendChild(sub);var card=document.createElement('div');card.style.height='100px';card.style.width='120px';card.style.backgroundColor='#007fbb';card.style.setAttribute('position','absolute');card.style.left='20px';card.style.top='5px';sub.appendChild(card);var title=document.createElement('div');title.style.setAttribute('position','absolute');title.style.left='5%';title.style.width='55%';title.style.height='30px';title.style.paddingLeft='35%';title.style.fontSize='24px';title.style.color='#fff';title.style.borderBottom='1px solid #fff';title.innerText='18';card.appendChild(title);var man=document.createElement('div');man.style.setAttribute('position','absolute');man.style.top='50px';man.style.left='5%';man.style.width='55%';man.style.height='30px';man.style.paddingLeft='18%';man.style.fontSize='22px';man.style.color='#fff';man.innerText='马若莉';card.appendChild(man);";
            //window.frames[2].frames[0].document.getElementById('btnFayao')
            //scriptObject.text = "window.frames[2].frames[0].document.getElementById('btnQuery').onmouseover=function(){alert('hasssshhaa ')}";
            //document.getElementById('main').onmouseover=function(){alert('hasssshhaa ')}
            //scriptObject.text = "var sub = window.frames[1].document.getElementById('td_left');";
            //scriptObject.text += "var card=document.createElement('div');card.style.height='200px';card.style.width='200px';card.style.backgroundColor='#007fbb';card.style.setAttribute('position','absolute');card.style.left='20px';card.style.top='30px';sub.appendChild(card);var title=document.createElement('div');title.style.setAttribute('position','absolute');title.style.left='5%';title.style.width='55%';title.style.height='50px';title.style.paddingLeft='35%';title.style.fontSize='36px';title.style.marginTop='30px';title.style.color='#fff';title.style.borderBottom='1px solid #fff';title.innerText='18';card.appendChild(title);var man=document.createElement('div');man.style.setAttribute('position','absolute');man.style.top='100px';man.style.left='5%';man.style.width='55%';man.style.height='50px';man.style.paddingLeft='18%';man.style.fontSize='36px';man.style.color='#fff';man.innerText='马若莉';card.appendChild(man);";
            //scriptObject.text += "var sub=document.createElement('div');sub.style.height='105px';sub.style.width='1000px';sub.style.backgroundColor='#ededed';document.getElementById('sub').appendChild(sub);var card=document.createElement('div');card.style.height='100px';card.style.width='120px';card.style.backgroundColor='#007fbb';card.style.setAttribute('position','absolute');card.style.left='20px';card.style.top='5px';sub.appendChild(card);var title=document.createElement('div');title.style.setAttribute('position','absolute');title.style.left='5%';title.style.width='55%';title.style.height='30px';title.style.paddingLeft='35%';title.style.fontSize='24px';title.style.color='#fff';title.style.borderBottom='1px solid #fff';title.innerText='18';card.appendChild(title);var man=document.createElement('div');man.style.setAttribute('position','absolute');man.style.top='50px';man.style.left='5%';man.style.width='55%';man.style.height='30px';man.style.paddingLeft='18%';man.style.fontSize='22px';man.style.color='#fff';man.innerText='马若莉';card.appendChild(man);";
            //scriptObject.text="window.frames[2].frames[0].document.getElementById('btnQuery').onmouseover = function(){ var info = getMan(); window.toQt.sendPatientInfo(info)}; function getMan() { var table = window.frames[2].frames[0].document.getElementById('gvInfo'); var t = ''; for (var i = 1; i < table.rows.length; i++) { t += table.rows[i].cells[0].innerText + ';' + table.rows[i].cells[2].innerText + '*'} return t};";
            //scriptObject.text = "var old_info = ''; ftimer = setInterval(function () { var gvInfo = window.frames[2].frames[0].document.getElementById('gvInfo'); if (gvInfo != undefined && gvInfo!= null) { var info = getMan(); if (info == '') { } else { if (old_info == info) { } else { old_info = info; alert(info); } } } else { } }, 1000);";
            //正确版本
            //scriptObject.text = "var old_info = ''; function getMan() { var table = window.frames[2].frames[0].document.getElementById('gvInfo'); var t = ''; for (var i = 1; i < table.rows.length; i++) { t += table.rows[i].cells[0].innerText + ';' + table.rows[i].cells[2].innerText + '*' } return t }ftimer = setInterval(function() { var gvInfo = window.frames[2].frames[0].document.getElementById('gvInfo'); if (gvInfo != undefined && gvInfo != null) { var info = getMan(); if (info == '') { } else { if (old_info == info) { } else { old_info = info; alert(info);window.toQt.sendPatientInfo(info); } } } else { } }, 1000); ";
            //scriptObject.text = "alert('bhco.cs')";
            //正确 版本
            //scriptObject.text = "var old_lblName = ''; function getLblName() { var item = window.frames[2].frames[0].document; return item.getElementById('lblName').innerText } var ltimer = setInterval(function () { var first = window.frames[2]; if (first != undefined && first != null) { var second = first.frames[0]; if (second != undefined && second != null) { var lblName = second.document.getElementById('lblName'); if (lblName != undefined && lblName != null) { var lblName = getLblName(); if (lblName != '') { if (old_lblName != lblName) { old_lblName = lblName; alert(lblName); window.toQt.sendPatientInfo(lblName) } } } } } }, 2000); var old_patient = ''; function getPatient() { var table = window.frames[2].frames[0].document.getElementById('toPatient'); return table.rows[0].cells[5].innerText } var ptimer = setInterval(function () { var first = window.frames[2]; if (first != undefined && first != null) { var second = first.frames[0]; if (second != undefined && second != null) { var patient = second.document.getElementById('toPatient'); if (patient != undefined && patient != null) { var patient = getPatient(); if (patient != '') { if (old_patient != patient) { old_patient = patient; alert(patient); window.toQt.sendPatientInfo(patient) } } } } } }, 2000);";



            //scriptObject.text = 'var old_name="";function get_name(){var patient=window.mrightFrame.workFrame.document.getElementById("tbPatient");return patient.rows[0].cells[5].innerText.split(" ")[0]}function check(){var name=get_name();if(name!=old_name){old_name=name;console.log("menzheng new  "+name+"  "+new Date());alert(name)}}var times=setInterval(function(){var first=window.mrightFrame;if(first!=undefined&&first!=null){try{var second=first.workFrame;if(second!=undefined&&second!=null){try{var d=window.mrightFrame.workFrame.document;if(d!=undefined&&d!=null){var disabled=window.mrightFrame.workFrame.document.getElementById("btnFayao").disabled;if(disabled==false)check();else console.log("menzheng old "+new Date())}}catch(err){console.log(err.message,"menzheng second undfined")}}}catch(err){console.log(err.message,"menzheng first undfined")}}},2000);var old_lblname="";function get_lblname(){var patient=window.mrightFrame.workFrame.document.getElementById("lblname");return patient.innerText}function check2(){var name=get_lblname();if(name!=old_lblname){old_lblname=name;console.log("zhuyuan new "+name+"  "+new Date());alert(name)}}var times2=setInterval(function(){var first=window.mrightFrame;if(first!=undefined&&first!=null){try{var second=first.workFrame;if(second!=undefined&&second!=null){try{var patient=window.mrightFrame.workFrame.document;if(patient!=undefined&&patient!=null){check2()}else{console.log("zhuyuan old"+new Date())}}catch(err){console.log(err.message,"zhuyuan second")}}}catch(err){console.log(err.message,"zhuyuan first")}}},2000);';
            scriptObject.text = "alert('aa')";
            //scriptObject.text += "var old_name='';function get_name(){var patient=window.mrightFrame.workFrame.document.getElementById('tbPatient');return patient.rows[0].cells[5].innerText.split(' ')[0]}function check(){var name=get_name();if(name!=old_name){old_name=name;console.log('menzheng new  '+name+'  '+new Date());alert(name)}}var times=setInterval(function(){var first=window.mrightFrame;if(first!=undefined&&first!=null){try{var second=first.workFrame;if(second!=undefined&&second!=null){try{var d=window.mrightFrame.workFrame.document;if(d!=undefined&&d!=null){var disabled=window.mrightFrame.workFrame.document.getElementById('btnFayao').disabled;if(disabled==false)check();else console.log('menzheng old '+new Date())}}catch(err){console.log(err.message,'menzheng second undfined')}}}catch(err){console.log(err.message,'menzheng first undfined')}}},2000);var old_lblname='';function get_lblname(){var patient=window.mrightFrame.workFrame.document.getElementById('lblname');return patient.innerText}function check2(){var name=get_lblname();if(name!=old_lblname){old_lblname=name;console.log('zhuyuan new '+name+'  '+new Date());alert(name)}}var times2=setInterval(function(){var first=window.mrightFrame;if(first!=undefined&&first!=null){try{var second=first.workFrame;if(second!=undefined&&second!=null){try{var patient=window.mrightFrame.workFrame.document;if(patient!=undefined&&patient!=null){check2()}else{console.log('zhuyuan old'+new Date())}}catch(err){console.log(err.message,'zhuyuan second')}}}catch(err){console.log(err.message,'zhuyuan first')}}},2000);";
            ((HTMLHeadElement)head).appendChild((IHTMLDOMNode)scriptObject);
        }
コード例 #16
0
ファイル: bho_relas.cs プロジェクト: robber2000/icaller
        public void OnDocumentComplete(object pDisp, ref object URL)
        {
            HTMLDocument document     = (HTMLDocument)webBrowser.Document;
            dynamic      window       = document.parentWindow;
            IExpando     ScriptObject = (IExpando)window;
            PropertyInfo btnEvent     = ScriptObject.GetProperty("toQt", BindingFlags.Default);

            if (btnEvent == null)
            {
                btnEvent = ScriptObject.AddProperty("toQt");
            }
            btnEvent.SetValue(ScriptObject, this, null);
            IHTMLElement head = (IHTMLElement)((IHTMLElementCollection)
                                               document.all.tags("head")).item(null, 0);
            IHTMLScriptElement scriptObject = (IHTMLScriptElement)document.createElement("script");

            scriptObject.type = @"text/javascript";
            //scriptObject.text = "alert('aa')";
            //scriptObject.text = "var myEles = document.getElementById('su'); if(myEles != undefined && myEles != null) {myEles.valuvalu";
            //scriptObject.text = "var data={'aa':document.getElementById('names')};$.ajax({type: 'POST',url: 'http://127.0.0.1:8000/opendata/test/',contentType: 'application/json;charset=utf-wind8',dataType: 'json',data: JSON.stringify(data),success: function (data) {  //console.log(data);})";
            //scriptObject.text = "  $('#btnQuery').click(function(){var trs=document.querySelectorAll('tr.DataGridItem');var keys=['流水号','处方号','姓名','病历号','看诊医生','看诊时间','是否已发药','发药时间','发药人员','处方(含耗材)金额','退药'];var data=[];for(var i=0;i<trs.length;i++){tds=trs[i].querySelectorAll('td');var item={};item={'流水号':tds[0].innerText,'处方号':tds[1].innerText,'姓名':tds[2].innerText,'病历号':tds[3].innerText,'看诊医生':tds[4].innerText,'看诊时间':tds[5].innerText,'是否已发药':tds[6].innerText,'发药时间':tds[7].innerText,'发药人员':tds[8].innerText,'处方(含耗材)金额':tds[9].innerText};data.push(item)};$.ajax({type:'POST',url:'http://121.204.198.52:8809/v13/opendata/test/',contentType:'application/json;charset=utf-8',dataType:'json',data:JSON.stringify(data),success:function(data){}})});";
            //scriptObject.text = "  $('#btnQuery').click(function(){var trs=document.querySelectorAll('tr.DataGridItem');var keys=['流水号','处方号','姓名','病历号','看诊医生','看诊时间','是否已发药','发药时间','发药人员','处方(含耗材)金额','退药'];var data=[];for(var i=0;i<trs.length;i++){tds=trs[i].querySelectorAll('td');var item={};item={'流水号':tds[0].innerText,'处方号':tds[1].innerText,'姓名':tds[2].innerText,'病历号':tds[3].innerText,'看诊医生':tds[4].innerText,'看诊时间':tds[5].innerText,'是否已发药':tds[6].innerText,'发药时间':tds[7].innerText,'发药人员':tds[8].innerText,'处方(含耗材)金额':tds[9].innerText};data.push(item)};$.ajax({type:'POST',url:'http://121.204.198.52:8809/v13/opendata/test/',contentType:'application/json;charset=utf-8',dataType:'json',data:JSON.stringify(data),success:function(data){}})});";
            //scriptObject.text = "  $('#btnQuery').click(var data={'tttt':'3dy.me'};$.ajax({type:'POST',url:'http://121.204.198.52:8809/v13/opendata/test/',contentType:'application/json;charset=utf-8',dataType:'json',data:JSON.stringify(data),success:function(data){}})});";
            //scriptObject.text = "  $('#btnQuery').click(var data={'tttt':'3dy.me'};$.ajax({type:'POST',url:'http://121.204.198.52:8809/v13/opendata/test/',contentType:'application/json;charset=utf-8',dataType:'json',data:JSON.stringify(data),success:function(data){}})});";
            //scriptObject.text = "  $(window.parent.frames['ifWorkFrame'].document).find('input#btnQuery').click(function(){alert('aa')})";
            //document.getElementById(id).contentDocument
            //scriptObject.text = "  $('#input').click(function(){alert('aa')})";
            //通知栏所在区域,打开区域
            //window.parent.document.getElementsByTagName('frameset')[2].setAttribute('rows', '105,*')
            //病人取药的tables
            //window.frames[2].frames[0].document.getElementById("gvInfo").innerText
            //查询按钮
            //window.frames[2].frames[0].document.getElementById("btnQuery").value

            //发药按钮(详情页内)
            //btnFayao window.frames[2].frames[0].document.getElementById("btnFayao")
            //  病人信息,名字,性别,年龄
            //病人信息(详情页内)
            //var tab = window.frames[2].frames[0].document.getElementById("tbPatient").rows[0].cells[5].innerHTML.split(" ")[0];


            //table.row[1].cells[10].onmouseover = function(){ alert("ss")}
            //}
            //测试调用自定义的DLL window.toQt.ie_add(99,100)+''
            // scriptObject.text = "var myEles = document.getElementById('su'); var kw=document.getElementById('kw').value ; myEles.onclick=aaa(kw);function aaa(kw){alert(window.toQt.ie_add(99,100));}";
            //scriptObject.text = "var sub = window.frames[1].document.getElementById('td_left');";
            //scriptObject.text += "var card=document.createElement('div');card.style.height='200px';card.style.width='200px';card.style.backgroundColor='#007fbb';card.style.setAttribute('position','absolute');card.style.left='20px';card.style.top='30px';sub.appendChild(card);var title=document.createElement('div');title.style.setAttribute('position','absolute');title.style.left='5%';title.style.width='55%';title.style.height='50px';title.style.paddingLeft='35%';title.style.fontSize='36px';title.style.marginTop='30px';title.style.color='#fff';title.style.borderBottom='1px solid #fff';title.innerText='18';card.appendChild(title);var man=document.createElement('div');man.style.setAttribute('position','absolute');man.style.top='100px';man.style.left='5%';man.style.width='55%';man.style.height='50px';man.style.paddingLeft='18%';man.style.fontSize='36px';man.style.color='#fff';man.innerText='马若莉';card.appendChild(man);";
            //scriptObject.text += "var sub=document.createElement('div');sub.style.height='105px';sub.style.width='1000px';sub.style.backgroundColor='#ededed';document.getElementById('sub').appendChild(sub);var card=document.createElement('div');card.style.height='100px';card.style.width='120px';card.style.backgroundColor='#007fbb';card.style.setAttribute('position','absolute');card.style.left='20px';card.style.top='5px';sub.appendChild(card);var title=document.createElement('div');title.style.setAttribute('position','absolute');title.style.left='5%';title.style.width='55%';title.style.height='30px';title.style.paddingLeft='35%';title.style.fontSize='24px';title.style.color='#fff';title.style.borderBottom='1px solid #fff';title.innerText='18';card.appendChild(title);var man=document.createElement('div');man.style.setAttribute('position','absolute');man.style.top='50px';man.style.left='5%';man.style.width='55%';man.style.height='30px';man.style.paddingLeft='18%';man.style.fontSize='22px';man.style.color='#fff';man.innerText='马若莉';card.appendChild(man);";
            //window.frames[2].frames[0].document.getElementById('btnFayao')
            //scriptObject.text = "window.frames[2].frames[0].document.getElementById('btnQuery').onmouseover=function(){alert('hasssshhaa ')}";
            //document.getElementById('main').onmouseover=function(){alert('hasssshhaa ')}
            //scriptObject.text = "var sub = window.frames[1].document.getElementById('td_left');";
            //scriptObject.text += "var card=document.createElement('div');card.style.height='200px';card.style.width='200px';card.style.backgroundColor='#007fbb';card.style.setAttribute('position','absolute');card.style.left='20px';card.style.top='30px';sub.appendChild(card);var title=document.createElement('div');title.style.setAttribute('position','absolute');title.style.left='5%';title.style.width='55%';title.style.height='50px';title.style.paddingLeft='35%';title.style.fontSize='36px';title.style.marginTop='30px';title.style.color='#fff';title.style.borderBottom='1px solid #fff';title.innerText='18';card.appendChild(title);var man=document.createElement('div');man.style.setAttribute('position','absolute');man.style.top='100px';man.style.left='5%';man.style.width='55%';man.style.height='50px';man.style.paddingLeft='18%';man.style.fontSize='36px';man.style.color='#fff';man.innerText='马若莉';card.appendChild(man);";
            //scriptObject.text += "var sub=document.createElement('div');sub.style.height='105px';sub.style.width='1000px';sub.style.backgroundColor='#ededed';document.getElementById('sub').appendChild(sub);var card=document.createElement('div');card.style.height='100px';card.style.width='120px';card.style.backgroundColor='#007fbb';card.style.setAttribute('position','absolute');card.style.left='20px';card.style.top='5px';sub.appendChild(card);var title=document.createElement('div');title.style.setAttribute('position','absolute');title.style.left='5%';title.style.width='55%';title.style.height='30px';title.style.paddingLeft='35%';title.style.fontSize='24px';title.style.color='#fff';title.style.borderBottom='1px solid #fff';title.innerText='18';card.appendChild(title);var man=document.createElement('div');man.style.setAttribute('position','absolute');man.style.top='50px';man.style.left='5%';man.style.width='55%';man.style.height='30px';man.style.paddingLeft='18%';man.style.fontSize='22px';man.style.color='#fff';man.innerText='马若莉';card.appendChild(man);";
            //scriptObject.text="window.frames[2].frames[0].document.getElementById('btnQuery').onmouseover = function(){ var info = getMan(); window.toQt.sendPatientInfo(info)}; function getMan() { var table = window.frames[2].frames[0].document.getElementById('gvInfo'); var t = ''; for (var i = 1; i < table.rows.length; i++) { t += table.rows[i].cells[0].innerText + ';' + table.rows[i].cells[2].innerText + '*'} return t};";
            //scriptObject.text = "var old_info = ''; ftimer = setInterval(function () { var gvInfo = window.frames[2].frames[0].document.getElementById('gvInfo'); if (gvInfo != undefined && gvInfo!= null) { var info = getMan(); if (info == '') { } else { if (old_info == info) { } else { old_info = info; alert(info); } } } else { } }, 1000);";
            //正确版本
            //scriptObject.text = "var old_info = ''; function getMan() { var table = window.frames[2].frames[0].document.getElementById('gvInfo'); var t = ''; for (var i = 1; i < table.rows.length; i++) { t += table.rows[i].cells[0].innerText + ';' + table.rows[i].cells[2].innerText + '*' } return t }ftimer = setInterval(function() { var gvInfo = window.frames[2].frames[0].document.getElementById('gvInfo'); if (gvInfo != undefined && gvInfo != null) { var info = getMan(); if (info == '') { } else { if (old_info == info) { } else { old_info = info; window.toQt.sendPatientInfo(info);alert('bug--->'+info); } } } else { } }, 1000); ";
            //scriptObject.text = "function createXMLHttpRequest(){if(window.XMLHttpRequest){xmlHttp=new XMLHttpRequest()}else{if(window.ActiveXObject){xmlHttp=new ActiveXObject('Microsoft.XMLHTTP')}}return xmlHttp;} ";
            //scriptObject.text  = scriptObject.text+ "var old_info = ''; function getMan() { var table = window.frames[2].frames[0].document.getElementById('gvInfo'); var t = ''; for (var i = 1; i < table.rows.length; i++) { t += table.rows[i].cells[0].innerText + ';' + table.rows[i].cells[2].innerText + '*' } return t }ftimer = setInterval(function() { var gvInfo = window.frames[2].frames[0].document.getElementById('gvInfo'); if (gvInfo != undefined && gvInfo != null) { var info = getMan(); if (info == '') { } else { if (old_info == info) { } else { old_info = info; alert('22bug'+info); var xmlHttp=createXMLHttpRequest();xmlHttp.onreadystatechange=function(){};xmlHttp.open('POST','http://121.204.198.52:8809/v13/opendata/test/',true);xmlHttp.setRequestHeader('Content-Type','application/json');xmlHttp.send(JSON.stringify({'A':333}));             } } } else { } }, 1000); ";
            //scriptObject.text="function ajax(options) { options = options ||{ }; optoins.type = (options.type || 'GET').toUpperCase(); options.dataType = options.dataType || 'json';params= formatParams(options.data); var xhr; if (window.XMLHttpRequest) { xhr = new XMLHttpRequest()} else { xhr = ActiveXObject('Microsoft.XMLHTTP')} xhr.onreadystatechange = function(){ if (xhr.readyState == 4) { var status = xhr.status; if (status >= 200 && status < 300) { options.success && options.success(xhr.responseText, xhr.responseXML)} else { options.error && options.error(status)} } } if (options.type == 'GET') { xhr.open('GET', options.url + '?' +params, true); xhr.send(null)} else if (options.type == 'POST') { xhr.open('POST', options.url, true); xhr.setRequestHeader('Content-Type', 'application/x-www-form-urlencoded'); xhr.send(params)} }  function formatParams(data) { var arr =[];for(var name in data) { arr.push(encodeURIComponent(name) + '=' + encodeURIComponent(data[name]))} arr.push(('v='Math.random()).replace('.', '')); return arr.join('&')} ajax({ url: 'http://121.204.198.52:8809/v13/opendata/test/',type: 'POST',dataType: 'json',data: { name: '马各马它',age: 18},success: function(response, xml){ },error: function(status){ } });";
            //string aa = "hello";
            scriptObject.text = @" var old_name = '';

function get_name() {
    var patient = window.mrightFrame.workFrame.document.getElementById('tbPatient');
    return patient.rows[0].cells[5].innerText.split(' ')[0];
}

function check() {
    var name = get_name();
    if (name != old_name) {
        old_name = name;
        window.toQt.sendPatientInfo(name)
        //alert(name);
    }
}

var times = setInterval(function () {
    var first = window.mrightFrame;
    if (first != undefined && first != null) {
        try {
            var second = first.workFrame;
            if (second != undefined && second != null) {
                try {
                    var d = window.mrightFrame.workFrame.document;

                    if (d != undefined && d != null) {
                        var disabled = window.mrightFrame.workFrame.document.getElementById('btnFayao').disabled;
                        if (disabled == false)
                            check();
                      
                    }
                } catch (err) {
                   
                }
            }
        } catch (err) {
           
        }
    }
}, 2000);




var old_lblname = '';

function get_lblname() {

    var patient = window.mrightFrame.workFrame.document.getElementById('lblname');
    return patient.innerText;
}

function check2() {
    var name = get_lblname();
    if (name != old_lblname) {
        old_lblname = name;
        window.toQt.sendPatientInfo(name)
        //alert(name);
    }
}
var times2 = setInterval(function () {
    var first = window.mrightFrame;
    if (first != undefined && first != null) {
        try {
            var second = first.workFrame;
            if (second != undefined && second != null) {
                try {
                    var patient = window.mrightFrame.workFrame.document;
                    if (patient != undefined && patient != null) {
                        check2();
                    } 
                } catch (err) {
                   
                }
            }
        } catch (err) {
            
        }
    }
}, 2000);
            ";
            ((HTMLHeadElement)head).appendChild((IHTMLDOMNode)scriptObject);
        }
コード例 #17
0
        /// <summary>
        /// Destroys object
        /// </summary>
        /// <param name="disposing">Flag, allowing destruction of
        /// managed objects contained in fields of class</param>
        private void Dispose(bool disposing)
        {
            if (!_disposed)
            {
                _disposed = true;

                _lastException = null;

                if (_siteItems != null)
                {
                    _siteItems.Clear();
                    _siteItems = null;
                }

                if (_dispatch != null)
                {
                    ComHelpers.ReleaseComObject(ref _dispatch, !disposing);
                    _dispatch = null;
                }

                if (_activeScriptParse != null)
                {
                    _activeScriptParse.Dispose();
                    _activeScriptParse = null;
                }

                _activeScript = null;
            }
        }
コード例 #18
0
 private static void RemoveProperty(IExpando expando, PropertyInfo property)
 {
     expando.RemoveMember(property);
 }
コード例 #19
0
        /// <summary>
        /// Initializes a script dispatch
        /// </summary>
        private void InitScriptDispatch()
        {
            IExpando dispatch = null;
            object obj;

            _activeScript.GetScriptDispatch(null, out obj);

            if (obj != null && obj.GetType().IsCOMObject)
            {
                dispatch = obj as IExpando;
            }

            if (dispatch == null)
            {
                throw new InvalidOperationException(Strings.Runtime_ActiveScriptDispatcherNotInitialized);
            }

            _dispatch = dispatch;
        }