当前位置: 首页>>代码示例>>C#>>正文


C# WebBrowser.InvokeScript方法代码示例

本文整理汇总了C#中System.Windows.Controls.WebBrowser.InvokeScript方法的典型用法代码示例。如果您正苦于以下问题:C# WebBrowser.InvokeScript方法的具体用法?C# WebBrowser.InvokeScript怎么用?C# WebBrowser.InvokeScript使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Windows.Controls.WebBrowser的用法示例。


在下文中一共展示了WebBrowser.InvokeScript方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: Run

        public override void Run(WebBrowser webBrowser, Action callBack = null)
        {
            var Script = string.Format("$('{0}').val('ok');", mJquerySelectObject);

            webBrowser.InvokeScript("execScript", new Object[] { Script, "JavaScript" });
            Script = string.Format("window.external.ClickHtmlElement($('{0}')[0]);",mJquerySelectObject);
            webBrowser.InvokeScript("execScript", new Object[] { Script, "JavaScript" });

            if(callBack != null)
                callBack();
        }
开发者ID:powerhai,项目名称:Jinchen,代码行数:11,代码来源:ClickLinkCommand.cs

示例2: BrowserMouseHelper

        public BrowserMouseHelper(WebBrowser browser)
        {
            _browser = browser;
            if (true)//browser.Source != null)
            {
                var border0 = VisualTreeHelper.GetChild(_browser, 0);
                var border1 = VisualTreeHelper.GetChild(border0, 0);
                var panZoom = VisualTreeHelper.GetChild(border1, 0);
                var grid = VisualTreeHelper.GetChild(panZoom, 0);
                border = VisualTreeHelper.GetChild(grid, 0) as Border;

                if (border != null)
                {
                    border.ManipulationStarted += Border_ManipulationStarted;
                    border.ManipulationDelta += Border_ManipulationDelta;
                    border.ManipulationCompleted += Border_ManipulationCompleted;
                    border.DoubleTap += Border_DoubleTap;
                    border.Hold += Border_Hold;
                    border.MouseLeftButtonDown += Border_MouseLeftButtonDown;
                }

                try
                {
                    _browser.InvokeScript("execScript", MinifiedMouseScript);
                }
                catch (Exception)
                {
                    Debug.WriteLine("BrowserHelper Failed to install mouse script in WebBrowser");
                }
            }
            browser.Loaded += new RoutedEventHandler(browser_Loaded);
        }
开发者ID:sanyaade-mobiledev,项目名称:SujiQ,代码行数:32,代码来源:BrowserMouseHelper.cs

示例3: handle

        public async Task<bool> handle(WebBrowser browser, Uri uri)
        {
            Credentials creds;
            try
            {
                creds = await requestCredentials(uri);
            }
            catch (TaskCanceledException)
            {
                return false;
            }

            string authScript = "(function() {var xhr = new XMLHttpRequest();xhr.open('HEAD', '{0}', false, '{1}', '{2}');xhr.send();})()";

            authScript = authScript.Replace("{0}", uri.ToString());
            authScript = authScript.Replace("{1}", creds.username.Replace("\\", "\\\\"));
            authScript = authScript.Replace("{2}", creds.password);

            Debug.WriteLine("Injecting script: {0}", authScript);

            try
            {
                browser.InvokeScript("eval", new string[] { authScript });
                return true;
            }
            catch (Exception)
            {
                return false;
            }
        }
开发者ID:alex028502,项目名称:cordova-plugin-auth-hardcoded,代码行数:30,代码来源:HttpAuthRequestHandler.cs

示例4: Run

 public override void Run (WebBrowser webBrowser, Action callBack = null)
 {
     var Script = string.Format("$('{0}').click();", mJquerySelectObject);
     webBrowser.InvokeScript("execScript", new Object[] { Script, "JavaScript" });
     if (callBack != null)
         callBack();
 }
开发者ID:powerhai,项目名称:Jinchen,代码行数:7,代码来源:ClickCommand.cs

示例5: dummyHandler

        private void dummyHandler(Object sender, EventArgs e, String eventName, String handle, WebBrowser wb)
        {

            var payload = "{\"_hnd\": \"" + handle +
                "\", \"type\": \"" + eventName +
                "\", \"sender\": " + parseObject(sender) +
                ", \"eventArgs\": " + parseObject(e) +
                "}";

            try
            {
                wb.InvokeScript("handleEvent", payload);
            }
            catch (Exception) {}
        }
开发者ID:jamesrgrinter,项目名称:titanium_mobile,代码行数:15,代码来源:MainPage.xaml.cs

示例6: Run

 public override void Run (WebBrowser webBrowser, Action callBack = null)
 {
     webBrowser.InvokeScript("execScript", new Object[] { Script, "JavaScript" });
     
 }
开发者ID:powerhai,项目名称:Jinchen,代码行数:5,代码来源:ScriptCommand.cs


注:本文中的System.Windows.Controls.WebBrowser.InvokeScript方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。