本文整理汇总了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;
}
示例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);
}
示例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;
}