Esempio n. 1
0
        AppInfo LoadApp(IAppHost host, string fullName, out Assembly includedAssembly, out Assembly resourcesAssembly)
        {
            resourcesAssembly = null;
            includedAssembly  = LoadAssembly(fullName);

            Type appBaseType = typeof(AppMetadata);

            Type[] appTypes = includedAssembly.GetTypes();
            Type   appType  = null;

            foreach (var type in appTypes)
            {
                if (appBaseType.IsAssignableFrom(type))
                {
                    appType = type;
                    break;
                }
            }
            if (appType == null)
            {
                return(null);
            }
            string resourcesAssemblyName = fullName.Substring(0, fullName.Length - 3) + "Resources.dll";

            if (File.Exists(resourcesAssemblyName))
            {
                resourcesAssembly = LoadAssembly(resourcesAssemblyName);
            }
            AppMetadata metadata = Activator.CreateInstance(appType) as AppMetadata;

            PreProcessAppMetadata(ref metadata, host);

            return(new AppInfo(metadata));
        }
Esempio n. 2
0
        void PreProcessAppMetadata(ref AppMetadata metadata, IAppHost currentHost)
        {
            if (null != metadata.MenuItems)
            {
                foreach (AppMenuItem menu in metadata.MenuItems)
                {
                    menu.Url = ProcessAppMenuUrl(menu.Url, metadata.Id, currentHost);
                }
            }

            string[] fragments = new string[] {
                string.Empty,
                currentHost.DirName,
                metadata.Id,
                "App.png"
            };
            metadata.Logo = string.Join("/", fragments);
        }
Esempio n. 3
0
 public AppInfo(AppMetadata appMetadata, bool isEnable)
 {
     Metadata = appMetadata;
     IsEnable = isEnable;
 }
Esempio n. 4
0
 public AppInfo(AppMetadata appMetadata)
 {
     Metadata = appMetadata;
 }