SVN r665
SVN-Revision: r665
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using Lskj.Business;
|
||||
using Lskj.Model;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
@@ -53,12 +54,27 @@ namespace Lskj.Control.BrowserSetting
|
||||
{
|
||||
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,8 +47,8 @@ namespace Lskj.Control.BrowserSetting
|
||||
return;
|
||||
}
|
||||
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 = HttpUtility.UrlDecode(szFilename);
|
||||
@@ -163,22 +163,4 @@ namespace Lskj.Control.BrowserSetting
|
||||
public static void Download(string URL, string FileName)
|
||||
{
|
||||
FrmSelectDownload frmSelectDownload = new FrmSelectDownload();
|
||||
frmSelectDownload.URL = URL;
|
||||
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();
|
||||
//}
|
||||
}
|
||||
}
|
||||
}
|
||||
frmSelectDownl
|
||||
@@ -21,61 +21,49 @@ namespace Lskj.Control.BrowserSetting
|
||||
{
|
||||
public class BsOpenModuleHandler : CefV8Handler
|
||||
{
|
||||
public CefV8Context V8Context;
|
||||
public BsOpenModuleHandler()
|
||||
{
|
||||
}
|
||||
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)
|
||||
{
|
||||
string arg0 = arguments[0].GetStringValue();
|
||||
string arg1 = arguments[1].GetStringValue();
|
||||
string arg2 = arguments[2].GetStringValue();
|
||||
string arg3 = arguments[3].GetStringValue();
|
||||
string arg4 = arguments[4].GetStringValue();
|
||||
if (ERPInfo.Instance.MainControl.InvokeRequired)
|
||||
{
|
||||
|
||||
ERPInfo.Instance.MainControl.Invoke(new Action(() =>
|
||||
{
|
||||
OpenModule(arg0, arg1, arg2, arg3, arg4);
|
||||
}));
|
||||
}
|
||||
else
|
||||
{
|
||||
OpenModule(arg0, arg1, arg2, arg3, arg4);
|
||||
}
|
||||
returnValue = CefV8Value.CreateUndefined();
|
||||
exception = null;
|
||||
return true;
|
||||
CefProcessMessage cefProcessMessage = CefProcessMessage.Create("OpenModule");
|
||||
cefProcessMessage.Arguments.SetString(0, arguments[0].GetStringValue());
|
||||
cefProcessMessage.Arguments.SetString(1, arguments[1].GetStringValue());
|
||||
cefProcessMessage.Arguments.SetString(2, arguments[2].GetStringValue());
|
||||
cefProcessMessage.Arguments.SetString(3, arguments[3].GetStringValue());
|
||||
cefProcessMessage.Arguments.SetString(4, arguments[4].GetStringValue());
|
||||
V8Context.GetFrame().SendProcessMessage(CefProcessId.Browser, cefProcessMessage);
|
||||
outreturnValue = CefV8Value.CreateUndefined();
|
||||
outexception = null;
|
||||
outtrn = true;
|
||||
}
|
||||
else if (name == "OpenOnRightClick" && arguments.Length == 4)
|
||||
{
|
||||
var arrayItem = arguments[0].GetStringValue(); // Assuming arrayItem is an array or object
|
||||
var rightId = arguments[1].GetStringValue();
|
||||
var MenuName = arguments[2].GetStringValue();
|
||||
var mMenuCode = arguments[3].GetStringValue();
|
||||
if (ERPInfo.Instance.MainControl.InvokeRequired)
|
||||
{
|
||||
|
||||
ERPInfo.Instance.MainControl.Invoke(new Action(() =>
|
||||
{
|
||||
OpenRightModule(arrayItem, rightId, MenuName, mMenuCode);
|
||||
}));
|
||||
}
|
||||
else
|
||||
{
|
||||
OpenRightModule(arrayItem, rightId, MenuName, mMenuCode);
|
||||
}
|
||||
|
||||
returnValue = CefV8Value.CreateUndefined();
|
||||
exception = null;
|
||||
return true;
|
||||
CefProcessMessage cefProcessMessage = CefProcessMessage.Create("OpenOnRightClick");
|
||||
cefProcessMessage.Arguments.SetString(0, arguments[0].GetStringValue());
|
||||
cefProcessMessage.Arguments.SetString(1, arguments[1].GetStringValue());
|
||||
cefProcessMessage.Arguments.SetString(2, arguments[2].GetStringValue());
|
||||
cefProcessMessage.Arguments.SetString(3, arguments[3].GetStringValue());
|
||||
V8Context.GetFrame().SendProcessMessage(CefProcessId.Browser, cefProcessMessage);
|
||||
outreturnValue = CefV8Value.CreateUndefined();
|
||||
outexception = null;
|
||||
outtrn = true;
|
||||
}
|
||||
|
||||
returnValue = null;
|
||||
exception = "Invalid method call";
|
||||
return false;
|
||||
else
|
||||
{
|
||||
outreturnValue = null;
|
||||
outexception = "Invalid method call";
|
||||
outtrn = false;
|
||||
}
|
||||
returnValue = outreturnValue;
|
||||
exception = outexception;
|
||||
return outtrn;
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -91,7 +79,7 @@ namespace Lskj.Control.BrowserSetting
|
||||
/// <param name="rightId"></param>
|
||||
/// <param name="MenuName"></param>
|
||||
/// <param name="mMenuCode"></param>
|
||||
public static void OpenRightModule(string arrayItem, string rightId, string MenuName, string mMenuCode)
|
||||
public static void OpenRightModule(string arrayItem, string rightId, string MenuName, string mMenuCode)
|
||||
{
|
||||
DataRow item = BaseImpl.GetDataRowResult(string.Format(@"select * from P_systempopupmenu where id='{0}'", rightId));
|
||||
if (item != null)
|
||||
@@ -287,28 +275,4 @@ namespace Lskj.Control.BrowserSetting
|
||||
mcpex.InitializeControl(new ModuleModel(MainImpl.GetSystemdllTab(moduleModel.SearchCondFormModuleCode)), null, null, true);
|
||||
if (StaticControl.ConditionsPanelDic.ContainsKey(args[4] + ""))
|
||||
{
|
||||
StaticControl.ConditionsPanelDic[args[4] + ""].Dispose();
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
StaticControl.ConditionsPanelDic[args[4] + "
|
||||
@@ -13,25 +13,7 @@ namespace Lskj.Control.BrowserSetting
|
||||
{
|
||||
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);
|
||||
};
|
||||
})();
|
||||
";
|
||||
CefRuntime.RegisterExtension("boundObject", extensionCode, bsOpenModuleHandler);
|
||||
base.OnWebKitInitialized();
|
||||
}
|
||||
}
|
||||
}
|
||||
var boundObject;
|
||||
if (!boundObject)
|
||||
boundObject = {};
|
||||
|
||||
@@ -6,24 +6,4 @@ using Xilium.CefGlue;
|
||||
|
||||
namespace Lskj.Control.BrowserSetting
|
||||
{
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
public class BsRequestHandle
|
||||
@@ -1,4 +1,5 @@
|
||||
using Lskj.Business;
|
||||
using Lskj.Model;
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
@@ -51,12 +52,27 @@ namespace Lskj.Control.BrowserSetting2
|
||||
{
|
||||
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.Linq;
|
||||
using System.Text;
|
||||
using Xilium.CefGlue;
|
||||
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
us
|
||||
Reference in New Issue
Block a user