using System; using System.Collections.Generic; using System.Linq; using System.Windows.Forms; using Lskj.Control; using Xilium.CefGlue; namespace Lskj.CallLibrary { static class Program { /// /// 应用程序的主入口点。 /// [STAThread] static void Main(string[] args) { CefRuntime.Load();//cef浏览器模块设置加载 var mainArgs = new CefMainArgs(args); var app = new DemoApp(); var exitCode = CefRuntime.ExecuteProcess(mainArgs, app); var settings = new CefSettings { MultiThreadedMessageLoop = true, LogSeverity = CefLogSeverity.Disable, LogFile = "CefGlue.log", Locale = "zh-CN" }; CefRuntime.Initialize(mainArgs, settings, app); Application.EnableVisualStyles(); Application.SetCompatibleTextRenderingDefault(false); FrmMain frmMain = new FrmMain(); //args = new[] { "192.168.0.240", "lserp_sbsh", "14269", "Billdocument_Id", "SHRK2404240016", "1", "管理员", "MB000301", "224B374F41968C76CC6AA3C25C385C71E24A66EB", "" }; //args = new[] { "114.116.65.41,13341", "lserp_jwd", "2194", "Billdocument_Id", "CGFP2104110002", "1", "管理员", "MB000301", "9DDECB584D8F4F8B91621D62CB6E1AF17A6FF852", "" }; //args = new[] { "114.116.65.41,13341", "lserp_nr", "2194", "Billdocument_Id", "WPD211029001", "1", "管理员", "MB000301", "9DDECB584D8F4F8B91621D62CB6E1AF17A6FF852", "" }; // 参数1:数据库地址 if (args != null && args.Length > 0 && !string.IsNullOrEmpty(args[0])) { frmMain.ServerAddress = args[0]; } else { MessageUtil.Show("参数1不能为空,应配置数据库地址并且不能为空!"); Application.Exit(); } // 参数2:数据库名称 if (args.Length > 1 && !string.IsNullOrEmpty(args[1])) { frmMain.ServerDBName = args[1]; } else { MessageUtil.Show("参数2不能为空,应配置数据库名称并且不能为空!"); Application.Exit(); } // 参数3:被调用的右键菜单ID if (args.Length > 2 && !string.IsNullOrEmpty(args[2])) { frmMain.RightMenuID = args[2]; } else { MessageUtil.Show("参数3不能为空,应配置被调用的右键菜单ID并且不能为空!"); Application.Exit(); } // 参数4:数据行主键字段 if (args.Length > 3 && !string.IsNullOrEmpty(args[3])) { frmMain.PrimaryKey = args[3]; } else { MessageUtil.Show("参数4不能为空,应配置数据行主键字段并且不能为空!"); Application.Exit(); } // 参数5:数据行主键值 if (args.Length > 4 && !string.IsNullOrEmpty(args[4])) { frmMain.PrimaryValue = args[4]; } else { MessageUtil.Show("参数5不能为空,应配置数据行主键值并且不能为空!"); Application.Exit(); } // 参数6:用户ID if (args.Length > 5 && !string.IsNullOrEmpty(args[5])) { frmMain.UserID = args[5]; } else { MessageUtil.Show("参数6不能为空,应配置用户ID并且不能为空!"); Application.Exit(); } // 参数7:用户名称 if (args.Length > 6 && !string.IsNullOrEmpty(args[6])) { frmMain.UserName = args[6]; } else { MessageUtil.Show("参数7不能为空,应配置用户名称并且不能为空!"); Application.Exit(); } // 参数8:模块编号 if (args.Length > 7 && !string.IsNullOrEmpty(args[7])) { frmMain.ModuleCode = args[7]; } else { MessageUtil.Show("参数8不能为空,应配置模块编号并且不能为空!"); Application.Exit(); } // 参数9:用户密码 if (args.Length > 8) { frmMain.Password = args[8]; } if (!settings.MultiThreadedMessageLoop) { Application.Idle += (sender, e) => { CefRuntime.DoMessageLoopWork(); }; } Application.Run(frmMain); CefRuntime.Shutdown(); } internal sealed class DemoApp : CefApp { protected override void OnBeforeCommandLineProcessing(string processType, CefCommandLine commandLine) { commandLine.AppendSwitch("ppapi-flash-version", "28.0.0.137"); commandLine.AppendSwitch("ppapi-flash-path", @"D:\测试\LSERP\Debug\pepflashplayer.dll"); } } } }