private static bool LoadMenu(NameSpace nameSpace) { if (!DllManager.ExistsAssembly(nameSpace)) { return(false); } string modulemenu = Path.Combine(Application.StartupPath, nameSpace.Library); string localize = System.Threading.Thread.CurrentThread.CurrentUICulture.Name; string menufile = string.Concat("menu.", localize, ".config"); string modulemenufile = Path.Combine(modulemenu, menufile); if (!File.Exists(modulemenufile)) { modulemenufile = Path.Combine(modulemenu, "menu.config"); } if (!File.Exists(modulemenufile)) { Debug.Assert(false, "Missing menu.config"); return(false); } XmlDocument moduleMenu = new XmlDocument(); moduleMenu.Load(modulemenufile); ApplicationMenuModule appModule; XmlNodeList moduleList = moduleMenu.SelectNodes("menu/module"); foreach (XmlNode moduleNode in moduleList) { string menu = moduleNode.Attributes["name"].Value; string icon = moduleNode.Attributes["icon"].Value; string modulensc = moduleNode.Attributes["namespace"].Value; NameSpace nsc = new NameSpace(nameSpace.Folder, nameSpace.Library, modulensc); if (!RegisterModule(nsc)) { continue; } appModule = ModuleList.Find(p => { return(p.Menu == menu); }); if (appModule == null) { appModule = new ApplicationMenuModule(nsc, menu, icon); ModuleList.Add(appModule); } XmlNodeList folderList = moduleNode.SelectNodes("folder"); LoadFolder(appModule, folderList); } return(true); }
private static System.Tuple <string, string> GetDllVersion(NameSpace amm) { amm.Application = "ModuleData.RegisterModule"; var registerTable = (RegisterModule)DllManager.CreateIstance(amm, null); if (registerTable != null) { return(new System.Tuple <string, string>(amm.Library, registerTable.DllVersion.ToString())); } return(null); }
private static bool RegisterModule(NameSpace nspace) { nspace.Application = "ModuleData.RegisterModule"; RegisterModule registerTable = (RegisterModule)DllManager.CreateIstance(nspace, null); if (registerTable != null) { if (SerialManager.IsActivate(registerTable.Application(), registerTable.Module())) { bool bOk = registerTable.CreateTable(GlobalInfo.DBaseInfo.dbManager.DB_Connection, GlobalInfo.UserInfo.userType); if (bOk) { registerTable.RegisterCountersAndCodes(); } } else { return(false); } } return(true); }