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


C# CefBrowser.SendProcessMessage方法代码示例

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


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

示例1: OnProcessMessageReceived

        protected override bool OnProcessMessageReceived(CefBrowser browser, CefProcessId sourceProcess, CefProcessMessage message)
        {
            Console.WriteLine("Render::OnProcessMessageReceived: SourceProcess={0}", sourceProcess);
            Console.WriteLine("Message Name={0} IsValid={1} IsReadOnly={2}", message.Name, message.IsValid, message.IsReadOnly);
            var arguments = message.Arguments;
            for (var i = 0; i < arguments.Count; i++)
            {
                var type = arguments.GetValueType(i);
                object value;
                switch (type)
                {
                    case CefValueType.Null: value = null; break;
                    case CefValueType.String: value = arguments.GetString(i); break;
                    case CefValueType.Int: value = arguments.GetInt(i); break;
                    case CefValueType.Double: value = arguments.GetDouble(i); break;
                    case CefValueType.Bool: value = arguments.GetBool(i); break;
                    default: value = null; break;
                }

                Console.WriteLine("  [{0}] ({1}) = {2}", i, type, value);
            }

            if (message.Name == "myMessage2") return true;

            var message2 = CefProcessMessage.Create("myMessage2");
            var success = browser.SendProcessMessage(CefProcessId.Renderer, message2);
            Console.WriteLine("Sending myMessage2 to renderer process = {0}", success);

            var message3 = CefProcessMessage.Create("myMessage3");
            var success2 = browser.SendProcessMessage(CefProcessId.Browser, message3);
            Console.WriteLine("Sending myMessage3 to browser process = {0}", success);

            return false;
        }
开发者ID:sim0629,项目名称:CefGlue,代码行数:34,代码来源:DemoRenderProcessHandler.cs

示例2: OnLoadStart

        protected override void OnLoadStart(CefBrowser browser, CefFrame frame)
        {
            base.OnLoadStart(browser, frame);

            var message = CefProcessMessage.Create("SetOverlayAPI");
            message.Arguments.SetString(0, frame.Name);
            browser.SendProcessMessage(CefProcessId.Renderer, message);
        }
开发者ID:alalwww,项目名称:OverlayPlugin,代码行数:8,代码来源:LoadHandler.cs

示例3: OnProcessMessageReceived

            protected override bool OnProcessMessageReceived(CefBrowser browser, CefProcessId sourceProcess, CefProcessMessage message)
            {
                if (message.Name == "renderProcessIdRequest")
                {
                    CefProcessMessage response = CefProcessMessage.Create("renderProcessIdResponse");
                    response.Arguments.SetInt(0, Process.GetCurrentProcess().Id);
                    browser.SendProcessMessage(CefProcessId.Browser, response);
                }

                return false;
            }
开发者ID:Zaharkov,项目名称:CLRBrowserSourcePlugin,代码行数:11,代码来源:BrowserApp.cs


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