Type GetTypeFromApp(AppInfo appInfo, string typeName)
        {
            Type typeFound = null;
            IEnumerable <Assembly> assemblies = _appDescriptorManager.GetAppAssembly(appInfo);

            foreach (Assembly assembly in assemblies)
            {
                if (null != assembly)
                {
                    try
                    {
                        typeFound = assembly.GetType(typeName);
                    }
                    catch (Exception)
                    {
#if DEBUG
                        System.Diagnostics.Debug.WriteLine(string.Format("加载类型出错 '{0}',无法从程序集 {1} 中加载该类型。"), typeName, assembly.FullName);
#endif
                    }
                    if (null != typeFound)
                    {
                        break;
                    }
                }
            }

            return(typeFound);
        }
Пример #2
0
        public void InitWe7()
        {
            IEnumerable <AppInfo> apps = _appDescriptorManager.GetApps();

            foreach (AppInfo info in apps)
            {
                if (info.IsEnable)
                {
                    IEnumerable <Assembly> assemblies = _appDescriptorManager.GetAppAssembly(info);
                    foreach (Assembly assembly in assemblies)
                    {
                        _factableRegister.RegisterHandlers(assembly);
                        break;
                    }
                }
            }
        }