/// <summary> /// 根据系统实例返回菜单列表。 /// </summary> /// <param name="systemInstance">系统实例。</param> /// <returns>菜单列表。</returns> public static MenuItemCollection GetMenuSetting(SystemInstance systemInstance) { string key = "Menu_"; if (systemInstance.SystemType == SystemType.Custom) { key += systemInstance.SystemId.ToString("d", System.Globalization.NumberFormatInfo.InvariantInfo); } else { key += systemInstance.SystemType.ToString(); } if (cacheSystemInstances[key] == null) { string path = SystemPath.GetMenuConfigPath(systemInstance); if (System.IO.File.Exists(path)) { MenuItemCollection list = Kenfor.KStar.Utility.Serialize.XmlSerializer.GetDeserializeObjectFromFile(path, typeof(MenuItemCollection)) as MenuItemCollection; cacheSystemInstances.Add(key, list, CacheItemPriority.Normal, null, new Microsoft.Practices.EnterpriseLibrary.Caching.Expirations.FileDependency(path)); } } return(cacheSystemInstances[key] as MenuItemCollection); }