diff --git a/插件库/Lskj.Main/Program.cs b/插件库/Lskj.Main/Program.cs index d9f9db6..83950db 100644 --- a/插件库/Lskj.Main/Program.cs +++ b/插件库/Lskj.Main/Program.cs @@ -19,6 +19,8 @@ using Lskj.Control.BrowserSetting; using Microsoft.Win32; using System.Resources; using System.Runtime.InteropServices; +using System.Resources; +using System.Diagnostics; namespace Lskj.Main { @@ -60,7 +62,7 @@ namespace Lskj.Main try { // 汉化DevExpress界面 - Thread.CurrentThread.CurrentUICulture = new CultureInfo("zh-Hans"); + Thread.CurrentThread.CurrentUICulture = new CultureInfo("zh-CH"); // 设置皮肤 BonusSkins.Register(); SkinManager.EnableFormSkins(); @@ -78,6 +80,7 @@ namespace Lskj.Main } AboutDevCompanion DC = new AboutDevCompanion(1, false); DC.Run(); + Register(); // 启动程序 Manager.StartForm(); CefRuntime.Shutdown(); @@ -129,8 +132,6 @@ namespace Lskj.Main commandLine.AppendSwitch("single-process", "1");//单线程模式,默认开启。(开启单线程模式后会影响浏览器的性能) } - - commandLine.AppendSwitch("no-proxy-server"); commandLine.AppendSwitch("ppapi-flash-version", "99.0.0.999"); commandLine.AppendSwitch("ppapi-flash-path", @"PepperFlash\pepflashplayer.dll"); @@ -200,4 +201,58 @@ namespace Lskj.Main RegistryKey subKey = regKey.OpenSubKey("AA_LS_Erp V2.0"); subKey = subKey.OpenSubKey("File", true); - result = subKey.GetValue("CefMultithreading", "0") + "" == "1" || \ No newline at end of file + result = subKey.GetValue("CefMultithreading", "0") + "" == "1" || subKey.GetValue("CefMultithreading", "0") + "" == "True" ? true : false; + return result; + } + catch (Exception ex) + { + + } + + return false; + } + + #region 注册自定义协议 + private static void Register() + { + string exePath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Lskj.CallWebLibrary.exe"); + using (var key = Registry.CurrentUser.CreateSubKey(@"Software\Classes\lserp")) + { + key.SetValue("", "URL:LSERP Protocol"); + key.SetValue("URL Protocol", ""); + } + using (var key = Registry.CurrentUser.CreateSubKey(@"Software\Classes\lserp\shell\open\command")) + { + key.SetValue("", $"\"{exePath}\" \"%1\""); + } + } + + private static void Unregister() + { + Registry.CurrentUser.DeleteSubKeyTree(@"Software\Classes\lserp", false); + } + #endregion + + //public static Form GetForm() + //{ + // Form X = new CEFdemo.Form1(); + // return X; + //} + public class Messager : IMessageFilter + { + public bool PreFilterMessage(ref Message m) + { + //如果检测到有鼠标或则键盘的消息,则使计数为0..... + if (m.Msg == 0x0200 || m.Msg == 0x0201 || m.Msg == 0x0204 || m.Msg == 0x0207) + { + Manager.isAwaitTime = 0; + } + if (m.Msg == 0x0100 && m.WParam != new IntPtr(0x0000001b) && Lskj.Model.ERPInfo.Instance.IsExecute) + { + return true; + } + return false; + } + } + } +}