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


C# JSObject.BindAsync方法代码示例

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


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

示例1: SongDisplayController

 /// <summary>
 /// Initializes a new instance of the SongDisplayController class.
 /// </summary>
 /// <param name="control">The web view that is controlled by this instance. Its IsProcessCreated property must be true.</param>
 /// <param name="features">The desired feature level.</param>
 public SongDisplayController(IWebView control, FeatureLevel features = FeatureLevel.None)
 {
     this.control = control;
     this.features = features;
     this.control.ConsoleMessage += (obj, target) =>
     {
         System.Windows.MessageBox.Show("SongDisplayController encountered JS error in " + target.Source + " (line " +  target.LineNumber + "): " + target.Message);
     };
     // FIXME: sometimes throws exception saying that "bridge" object already exists
     bridge = this.control.CreateGlobalJavascriptObject("bridge");
     bridge.BindAsync("callbackLoaded", (sender, args) => OnSongLoaded());
     bridge["featureLevel"] = new JSValue(JsonConvert.SerializeObject(features));
 }
开发者ID:Boddlnagg,项目名称:WordsLive,代码行数:18,代码来源:SongDisplayController.cs

示例2: Load

        public void Load()
        {
            base.Load(true); // TODO: set to false
            int nr = 0;
            do
            {
                uriKey = "pdfdoc" + (nr++) + ".pdf";
            } while (UriMapDataSource.Instance.Exists(uriKey));

            UriMapDataSource.Instance.Add(uriKey, Document.Uri);
            bridge = this.Control.Web.CreateGlobalJavascriptObject("bridge");
            bridge["document"] = "asset://WordsLive/urimap/" + uriKey;
            bridge.BindAsync("loaded", (sender, args) => {
                IsLoaded = true;
                OnDocumentLoaded();
            });
            //this.Control.Web.ConsoleMessage += (sender, args) => System.Windows.MessageBox.Show(args.Source + " (" + args.LineNumber + "): " + args.Message);
            this.Control.Web.Source = new Uri("asset://WordsLive/pdf.html");
        }
开发者ID:SolidStumbler,项目名称:WordsLive,代码行数:19,代码来源:PdfPresentation.cs

示例3: LoadContent

        protected override void LoadContent()
        {
            if (_area.IsEmpty)
            {
                _area = GraphicsDevice.Viewport.Bounds;
                _newArea = GraphicsDevice.Viewport.Bounds;
            }
            WebViewTexture = new Texture2D(Game.GraphicsDevice, _area.Width, _area.Height, false, SurfaceFormat.Color);

            _imageBytes = new byte[_area.Width * 4 * _area.Height];

            _awesomiumContext.Post(state =>
            {
                var path = @"file:///C:/Sourcecode/BEPUMono/BEPUMono/bin/Windows/Debug/UI/Screens/HUD.html";
                //var path = "http://www.google.com";
                WebView.Source = new Uri(path);
                WebView.DocumentReady += (sender, args) =>
                {
                    _jsObject = WebView.CreateGlobalJavascriptObject("game");
                    _jsObject.BindAsync("getData", delegate(object o, JavascriptMethodEventArgs eventArgs)
                    {
                        JSObject window = WebView.ExecuteJavascriptWithResult("window");

                        if (window == null)
                            return;

                        using (window)
                        {
                            window.InvokeAsync("setValue", "debug_fps", CurrentFPS);
                            window.InvokeAsync("setValue", "debug_active_obj", CurrentActiveObjects);
                        }
                    });
                };

            }, null);
        }
开发者ID:PaTraVis,项目名称:NewHorizons,代码行数:36,代码来源:BasicUserHUD.cs


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