SVN r665
SVN-Revision: r665
This commit is contained in:
@@ -1,4 +1,5 @@
|
|||||||
using Lskj.Business;
|
using Lskj.Business;
|
||||||
|
using Lskj.Model;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
@@ -53,12 +54,27 @@ namespace Lskj.Control.BrowserSetting
|
|||||||
{
|
{
|
||||||
return contextMenuHandler;
|
return contextMenuHandler;
|
||||||
}
|
}
|
||||||
public void Created(CefBrowser cefBrowser)
|
protected override bool OnProcessMessageReceived(CefBrowser browser, CefFrame frame, CefProcessId sourceProcess, CefProcessMessage message)
|
||||||
{
|
{
|
||||||
if (OnCreated != null)
|
if (message.Name.Equals("OpenModule"))
|
||||||
{
|
{
|
||||||
OnCreated(cefBrowser, EventArgs.Empty);
|
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(() =>
|
||||||
|
{
|
||||||
|
BsOpenModuleHandler.OpenModule(arg0, arg1, arg2, arg3, arg4);
|
||||||
|
}));
|
||||||
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
BrowserSetting.BsOpenModuleHandler.OpenModule(arg0, arg1, arg2, arg3, arg4);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
else if (message.Name.Equals("OpenOnRightClick"))
|
||||||
}
|
{
|
||||||
|
|
||||||
@@ -47,7 +47,7 @@ namespace Lskj.Control.BrowserSetting
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
string[] webpaths = Regex.Split(downloadItem.Url, "fileRoot/", RegexOptions.IgnoreCase);
|
string[] webpaths = Regex.Split(downloadItem.Url, "fileRoot/", RegexOptions.IgnoreCase);
|
||||||
string webpath = webpaths[webpaths.Length-1];
|
string webpath = webpaths[webpaths.Length - 1];
|
||||||
|
|
||||||
|
|
||||||
string szFilename = downloadItem.Url.Substring(downloadItem.Url.LastIndexOf('/') + 1);//简单处理文件名,实际中还需要单独处理,这里有BUG
|
string szFilename = downloadItem.Url.Substring(downloadItem.Url.LastIndexOf('/') + 1);//简单处理文件名,实际中还需要单独处理,这里有BUG
|
||||||
@@ -163,22 +163,4 @@ namespace Lskj.Control.BrowserSetting
|
|||||||
public static void Download(string URL, string FileName)
|
public static void Download(string URL, string FileName)
|
||||||
{
|
{
|
||||||
FrmSelectDownload frmSelectDownload = new FrmSelectDownload();
|
FrmSelectDownload frmSelectDownload = new FrmSelectDownload();
|
||||||
frmSelectDownload.URL = URL;
|
frmSelectDownl
|
||||||
frmSelectDownload.FileName = FileName;
|
|
||||||
frmSelectDownload.Show();
|
|
||||||
//SaveFileDialog saveFileDialog = new SaveFileDialog();
|
|
||||||
//saveFileDialog.FileName = FileName;
|
|
||||||
//saveFileDialog.Title = "下载模板文件到";
|
|
||||||
//saveFileDialog.RestoreDirectory = true;
|
|
||||||
////点了保存按钮进入
|
|
||||||
//if (saveFileDialog.ShowDialog() == DialogResult.OK)
|
|
||||||
//{
|
|
||||||
// string localFilePath = System.IO.Path.GetFullPath(saveFileDialog.FileName);//获得文件路径,含文件名
|
|
||||||
// string fileNameExt = localFilePath.Substring(localFilePath.LastIndexOf("\\") + 1);//获取文件名,不带路径
|
|
||||||
// string FilePath = localFilePath.Substring(0, localFilePath.LastIndexOf("\\"));//获取文件路径,不带文件名
|
|
||||||
// FrmDownload frm = new FrmDownload(URL, FileName, localFilePath);
|
|
||||||
// frm.Show();
|
|
||||||
//}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -21,61 +21,49 @@ namespace Lskj.Control.BrowserSetting
|
|||||||
{
|
{
|
||||||
public class BsOpenModuleHandler : CefV8Handler
|
public class BsOpenModuleHandler : CefV8Handler
|
||||||
{
|
{
|
||||||
|
public CefV8Context V8Context;
|
||||||
public BsOpenModuleHandler()
|
public BsOpenModuleHandler()
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
protected override bool Execute(string name, CefV8Value obj, CefV8Value[] arguments, out CefV8Value returnValue, out string exception)
|
protected override bool Execute(string name, CefV8Value obj, CefV8Value[] arguments, out CefV8Value returnValue, out string exception)
|
||||||
{
|
{
|
||||||
|
CefV8Value outreturnValue = null;
|
||||||
|
string outexception = "";
|
||||||
|
bool outtrn = false;
|
||||||
if (name == "OpenModule" && arguments.Length == 5)
|
if (name == "OpenModule" && arguments.Length == 5)
|
||||||
{
|
{
|
||||||
string arg0 = arguments[0].GetStringValue();
|
CefProcessMessage cefProcessMessage = CefProcessMessage.Create("OpenModule");
|
||||||
string arg1 = arguments[1].GetStringValue();
|
cefProcessMessage.Arguments.SetString(0, arguments[0].GetStringValue());
|
||||||
string arg2 = arguments[2].GetStringValue();
|
cefProcessMessage.Arguments.SetString(1, arguments[1].GetStringValue());
|
||||||
string arg3 = arguments[3].GetStringValue();
|
cefProcessMessage.Arguments.SetString(2, arguments[2].GetStringValue());
|
||||||
string arg4 = arguments[4].GetStringValue();
|
cefProcessMessage.Arguments.SetString(3, arguments[3].GetStringValue());
|
||||||
if (ERPInfo.Instance.MainControl.InvokeRequired)
|
cefProcessMessage.Arguments.SetString(4, arguments[4].GetStringValue());
|
||||||
{
|
V8Context.GetFrame().SendProcessMessage(CefProcessId.Browser, cefProcessMessage);
|
||||||
|
outreturnValue = CefV8Value.CreateUndefined();
|
||||||
ERPInfo.Instance.MainControl.Invoke(new Action(() =>
|
outexception = null;
|
||||||
{
|
outtrn = true;
|
||||||
OpenModule(arg0, arg1, arg2, arg3, arg4);
|
|
||||||
}));
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
OpenModule(arg0, arg1, arg2, arg3, arg4);
|
|
||||||
}
|
|
||||||
returnValue = CefV8Value.CreateUndefined();
|
|
||||||
exception = null;
|
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
else if (name == "OpenOnRightClick" && arguments.Length == 4)
|
else if (name == "OpenOnRightClick" && arguments.Length == 4)
|
||||||
{
|
{
|
||||||
var arrayItem = arguments[0].GetStringValue(); // Assuming arrayItem is an array or object
|
CefProcessMessage cefProcessMessage = CefProcessMessage.Create("OpenOnRightClick");
|
||||||
var rightId = arguments[1].GetStringValue();
|
cefProcessMessage.Arguments.SetString(0, arguments[0].GetStringValue());
|
||||||
var MenuName = arguments[2].GetStringValue();
|
cefProcessMessage.Arguments.SetString(1, arguments[1].GetStringValue());
|
||||||
var mMenuCode = arguments[3].GetStringValue();
|
cefProcessMessage.Arguments.SetString(2, arguments[2].GetStringValue());
|
||||||
if (ERPInfo.Instance.MainControl.InvokeRequired)
|
cefProcessMessage.Arguments.SetString(3, arguments[3].GetStringValue());
|
||||||
{
|
V8Context.GetFrame().SendProcessMessage(CefProcessId.Browser, cefProcessMessage);
|
||||||
|
outreturnValue = CefV8Value.CreateUndefined();
|
||||||
ERPInfo.Instance.MainControl.Invoke(new Action(() =>
|
outexception = null;
|
||||||
{
|
outtrn = true;
|
||||||
OpenRightModule(arrayItem, rightId, MenuName, mMenuCode);
|
|
||||||
}));
|
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
OpenRightModule(arrayItem, rightId, MenuName, mMenuCode);
|
outreturnValue = null;
|
||||||
|
outexception = "Invalid method call";
|
||||||
|
outtrn = false;
|
||||||
}
|
}
|
||||||
|
returnValue = outreturnValue;
|
||||||
returnValue = CefV8Value.CreateUndefined();
|
exception = outexception;
|
||||||
exception = null;
|
return outtrn;
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
returnValue = null;
|
|
||||||
exception = "Invalid method call";
|
|
||||||
return false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/// <summary>
|
/// <summary>
|
||||||
@@ -287,28 +275,4 @@ namespace Lskj.Control.BrowserSetting
|
|||||||
mcpex.InitializeControl(new ModuleModel(MainImpl.GetSystemdllTab(moduleModel.SearchCondFormModuleCode)), null, null, true);
|
mcpex.InitializeControl(new ModuleModel(MainImpl.GetSystemdllTab(moduleModel.SearchCondFormModuleCode)), null, null, true);
|
||||||
if (StaticControl.ConditionsPanelDic.ContainsKey(args[4] + ""))
|
if (StaticControl.ConditionsPanelDic.ContainsKey(args[4] + ""))
|
||||||
{
|
{
|
||||||
StaticControl.ConditionsPanelDic[args[4] + ""].Dispose();
|
StaticControl.ConditionsPanelDic[args[4] + "
|
||||||
StaticControl.ConditionsPanelDic[args[4] + ""] = mcpex;
|
|
||||||
}
|
|
||||||
else
|
|
||||||
{
|
|
||||||
StaticControl.ConditionsPanelDic.Add(args[4] + "", mcpex);
|
|
||||||
}
|
|
||||||
DialogResult dialogResult = mcpex.ShowDialog();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
ERPInfo.Instance.PageControl.TabPages.Add(tp);
|
|
||||||
ERPInfo.Instance.PageControl.SelectedTabPage = tp;
|
|
||||||
ERPInfo.Instance.ModuleForms.Add(guid, module);
|
|
||||||
|
|
||||||
}
|
|
||||||
catch (Exception ex)
|
|
||||||
{
|
|
||||||
string Message = ErrorMessage.PromptErrorMessage(ex);
|
|
||||||
MessageUtil.Show(ex.InnerException != null ? ex.InnerException.Message : ex.Message);
|
|
||||||
LogHelper.Instance.WriteError(ex);
|
|
||||||
//LogUtil.WriteError("打开" + module.Name + "模块失败!", ex);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -13,25 +13,7 @@ namespace Lskj.Control.BrowserSetting
|
|||||||
{
|
{
|
||||||
bsOpenModuleHandler = new BsOpenModuleHandler();
|
bsOpenModuleHandler = new BsOpenModuleHandler();
|
||||||
string extensionCode = @"
|
string extensionCode = @"
|
||||||
var boundObject;
|
var boundObject;
|
||||||
if (!boundObject)
|
if (!boundObject)
|
||||||
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);
|
|
||||||
};
|
|
||||||
})();
|
|
||||||
";
|
|
||||||
CefRuntime.RegisterExtension("boundObject", extensionCode, bsOpenModuleHandler);
|
|
||||||
base.OnWebKitInitialized();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -6,24 +6,4 @@ using Xilium.CefGlue;
|
|||||||
|
|
||||||
namespace Lskj.Control.BrowserSetting
|
namespace Lskj.Control.BrowserSetting
|
||||||
{
|
{
|
||||||
public class BsRequestHandler : CefRequestHandler
|
public class BsRequestHandle
|
||||||
{
|
|
||||||
protected override CefResourceRequestHandler GetResourceRequestHandler(CefBrowser browser, CefFrame frame, CefRequest request, bool isNavigation, bool isDownload, string requestInitiator, ref bool disableDefaultHandling)
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override bool OnBeforeBrowse(CefBrowser browser, CefFrame frame, CefRequest request, bool userGesture, bool isRedirect)
|
|
||||||
{
|
|
||||||
//DemoApp.BrowserMessageRouter.OnBeforeBrowse(browser, frame);
|
|
||||||
return base.OnBeforeBrowse(browser, frame, request, userGesture, isRedirect);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void OnRenderProcessTerminated(CefBrowser browser, CefTerminationStatus status)
|
|
||||||
{
|
|
||||||
//browser.StopLoad();
|
|
||||||
browser.Reload();
|
|
||||||
//DemoApp.BrowserMessageRouter.OnRenderProcessTerminated(browser);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@@ -1,4 +1,5 @@
|
|||||||
using Lskj.Business;
|
using Lskj.Business;
|
||||||
|
using Lskj.Model;
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
@@ -51,12 +52,27 @@ namespace Lskj.Control.BrowserSetting2
|
|||||||
{
|
{
|
||||||
return contextMenuHandler;
|
return contextMenuHandler;
|
||||||
}
|
}
|
||||||
public void Created(CefBrowser cefBrowser)
|
protected override bool OnProcessMessageReceived(CefBrowser browser, CefFrame frame, CefProcessId sourceProcess, CefProcessMessage message)
|
||||||
{
|
{
|
||||||
if (OnCreated != null)
|
if (message.Name.Equals("OpenModule"))
|
||||||
{
|
{
|
||||||
OnCreated(cefBrowser, EventArgs.Empty);
|
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
|
||||||
Binary file not shown.
@@ -2,28 +2,4 @@
|
|||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
using System.Linq;
|
using System.Linq;
|
||||||
using System.Text;
|
using System.Text;
|
||||||
using Xilium.CefGlue;
|
us
|
||||||
|
|
||||||
namespace Lskj.Control.BrowserSetting2
|
|
||||||
{
|
|
||||||
public class BsRequestHandler : CefRequestHandler
|
|
||||||
{
|
|
||||||
protected override CefResourceRequestHandler GetResourceRequestHandler(CefBrowser browser, CefFrame frame, CefRequest request, bool isNavigation, bool isDownload, string requestInitiator, ref bool disableDefaultHandling)
|
|
||||||
{
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override bool OnBeforeBrowse(CefBrowser browser, CefFrame frame, CefRequest request, bool userGesture, bool isRedirect)
|
|
||||||
{
|
|
||||||
//DemoApp.BrowserMessageRouter.OnBeforeBrowse(browser, frame);
|
|
||||||
return base.OnBeforeBrowse(browser, frame, request, userGesture, isRedirect);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected override void OnRenderProcessTerminated(CefBrowser browser, CefTerminationStatus status)
|
|
||||||
{
|
|
||||||
//browser.StopLoad();
|
|
||||||
browser.Reload();
|
|
||||||
//DemoApp.BrowserMessageRouter.OnRenderProcessTerminated(browser);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Reference in New Issue
Block a user