Files
lserp_cs_6.0/插件库/Lskj.Control/BrowserSetting/BsRenderProcessHandler.cs
2026-07-02 10:11:39 +00:00

53 lines
1.9 KiB
C#

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Xilium.CefGlue;
namespace Lskj.Control.BrowserSetting
{
public class BsRenderProcessHandler : CefRenderProcessHandler
{
private BsOpenModuleHandler bsOpenModuleHandler;
protected override void OnWebKitInitialized()
{
bsOpenModuleHandler = new BsOpenModuleHandler();
string extensionCode = @"
var boundObject;
if (!boundObject)
boundObject = {};
(function()
{
boundObject.OpenModule = function(menuId, menuName, dllName, modelFlag, urlParams)
{
native function OpenModule();
return OpenModule(menuId, menuName, dllName, modelFlag, urlParams);
};
boundObject.OpenOnRightClick = function(arrayItem, rightId,MenuName,mMenuCode)
{
native function OpenOnRightClick();
return OpenOnRightClick(arrayItem, rightId,MenuName,mMenuCode);
};
boundObject.CloseWin = function()
{
native function CloseWin();
return CloseWin();
};
boundObject.SelectPro = function(rowdata,isclose)
{
native function SelectPro();
return SelectPro(rowdata,isclose);
};
})();
";
CefRuntime.RegisterExtension("boundObject", extensionCode, bsOpenModuleHandler);
base.OnWebKitInitialized();
}
protected override void OnContextCreated(CefBrowser browser, CefFrame frame, CefV8Context context)
{
bsOpenModuleHandler.V8Context = context;
base.OnContextCreated(browser, frame, context);
}
}
}