ed6a289601
SVN-Revision: r899
92 lines
3.7 KiB
C#
92 lines
3.7 KiB
C#
using Lskj.Business;
|
|
using Lskj.Model;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
using Xilium.CefGlue;
|
|
|
|
namespace Lskj.Control.BrowserSetting2
|
|
{
|
|
public class BsClient : CefClient
|
|
{
|
|
public FrmWebBrowser2 frmWebBrowser;
|
|
public event EventHandler OnCreated;
|
|
private readonly CefLifeSpanHandler lifeSpanHandler;
|
|
private readonly CefDownloadHandler downloadHandler;
|
|
private readonly CefKeyboardHandler keyboardHandler;
|
|
private readonly CefFocusHandler focusHandler;
|
|
private readonly CefRequestHandler requestHandler;
|
|
private readonly CefContextMenuHandler contextMenuHandler;
|
|
public BsClient(int RightKeyFlag = 0, bool AllowDownload = true)
|
|
{
|
|
if (SystemInfo.Instance.BrowserRight) RightKeyFlag = 1;
|
|
lifeSpanHandler = new BsLifeSpanHandler(this);
|
|
downloadHandler = new BsDownloadHandler(AllowDownload);
|
|
keyboardHandler = new BsKeyboardHandler();
|
|
focusHandler = new BsFocusHandler();
|
|
requestHandler = new BsRequestHandler();
|
|
contextMenuHandler = new BsContextMenuHandler(RightKeyFlag);
|
|
}
|
|
protected override CefLifeSpanHandler GetLifeSpanHandler()
|
|
{
|
|
return lifeSpanHandler;
|
|
}
|
|
protected override CefDownloadHandler GetDownloadHandler()
|
|
{
|
|
return downloadHandler;
|
|
}
|
|
protected override CefKeyboardHandler GetKeyboardHandler()
|
|
{
|
|
return keyboardHandler;
|
|
}
|
|
protected override CefFocusHandler GetFocusHandler()
|
|
{
|
|
return focusHandler;
|
|
}
|
|
protected override CefRequestHandler GetRequestHandler()
|
|
{
|
|
return requestHandler;
|
|
}
|
|
protected override CefContextMenuHandler GetContextMenuHandler()
|
|
{
|
|
return contextMenuHandler;
|
|
}
|
|
protected override bool OnProcessMessageReceived(CefBrowser browser, CefFrame frame, CefProcessId sourceProcess, CefProcessMessage message)
|
|
{
|
|
if (message.Name.Equals("OpenModule"))
|
|
{
|
|
string arg0 = message.Arguments.GetString(0);
|
|
string arg1 = message.Arguments.GetString(1);
|
|
string arg2 = message.Arguments.GetString(2);
|
|
string arg3 = message.Arguments.GetString(3);
|
|
string arg4 = message.Arguments.GetString(4);
|
|
if (ERPInfo.Instance.MainControl.InvokeRequired)
|
|
{
|
|
ERPInfo.Instance.MainControl.Invoke(new Action(() =>
|
|
{
|
|
BrowserSetting.BsOpenModuleHandler.OpenModule(arg0, arg1, arg2, arg3, arg4);
|
|
}));
|
|
}
|
|
else
|
|
{
|
|
BrowserSetting.BsOpenModuleHandler.OpenModule(arg0, arg1, arg2, arg3, arg4);
|
|
}
|
|
}
|
|
else if (message.Name.Equals("OpenOnRightClick"))
|
|
{
|
|
string arg0 = message.Arguments.GetString(0);
|
|
string arg1 = message.Arguments.GetString(1);
|
|
string arg2 = message.Arguments.GetString(2);
|
|
string arg3 = message.Arguments.GetString(3);
|
|
if (ERPInfo.Instance.MainControl.InvokeRequired)
|
|
{
|
|
ERPInfo.Instance.MainControl.Invoke(new Action(() =>
|
|
{
|
|
BrowserSetting.BsOpenModuleHandler.OpenRightModule(arg0, arg1, arg2, arg3);
|
|
}));
|
|
}
|
|
else
|
|
{
|
|
BrowserSetting.BsOpenModuleHandler.OpenRightModule(arg0, ar |