Ejemplo n.º 1
0
        /// <summary>
        /// Gets the <see cref="CompositionContainer"/> for the module the requested url belongs to.
        /// </summary>
        /// <param name="relativeRequestUrl">The requested url.</param>
        /// <returns>A <see cref="CompositionContainer"/> instance.</returns>
        public CompositionContainer GetContainer(string relativeRequestUrl)
        {
            IModuleEnumerator moduleEnumerator = _rootContainer.Services.Get <IModuleEnumerator>(true);

            IModuleInfo[] modules = moduleEnumerator.EnumerateModules();
            if (modules == null)
            {
                return(_rootContainer);
            }

            List <IModuleInfo> matches = new List <IModuleInfo>();

            foreach (IModuleInfo moduleInfo in modules)
            {
                if (!String.IsNullOrEmpty(moduleInfo.VirtualPath) &&
                    relativeRequestUrl.IndexOf(moduleInfo.VirtualPath, StringComparison.InvariantCultureIgnoreCase) != -1)
                {
                    matches.Add(moduleInfo);
                }
            }
            if (matches.Count == 0)
            {
                return(_rootContainer);
            }

            return(_rootContainer.Containers[GetMatch(matches, relativeRequestUrl).Name]);
        }
Ejemplo n.º 2
0
        public void CopyInfo()
        {
            StringBuilder str = new StringBuilder();

            str.Append(Application.ProductName);
            str.Append("\t");
            str.AppendLine(Application.ProductVersion);
            str.AppendLine();

            str.Append(".NET Framework");
            str.Append("\t");
            str.AppendLine(Assembly.GetExecutingAssembly().ImageRuntimeVersion);
            str.AppendLine();

            foreach (IModuleInfo info in moduleEnumerator.EnumerateModules())
            {
                AssemblyName assemblyName = Assembly.ReflectionOnlyLoadFrom(info.AssemblyFile).GetName();
                str.Append(info.AssemblyFile);
                str.Append("\t");
                str.Append(assemblyName.Version.ToString());
                str.AppendLine();
            }

            Clipboard.SetText(str.ToString(), TextDataFormat.UnicodeText);
        }
Ejemplo n.º 3
0
        private void LoadModules()
        {
            IModuleLoaderService loader        = rootWorkItem.Services.Get <IModuleLoaderService>(true);
            IModuleEnumerator    modEnumerator = rootWorkItem.Services.Get <IModuleEnumerator>(true);

            if (modEnumerator != null)
            {
                loader.Load(rootWorkItem, modEnumerator.EnumerateModules());
            }
        }
Ejemplo n.º 4
0
        /// <summary>
        /// Loads the application modules into the root container.
        /// </summary>
        protected virtual void LoadModules()
        {
            IModuleLoaderService loader           = RootContainer.Services.Get <IModuleLoaderService>(true);
            IModuleEnumerator    moduleEnumerator = RootContainer.Services.Get <IModuleEnumerator>(true);

            if (moduleEnumerator != null)
            {
                loader.Load(RootContainer, moduleEnumerator.EnumerateModules());
            }
        }
Ejemplo n.º 5
0
        /// <summary>
        /// Searches for specific module configuration and configures each module when that configuration is available.
        /// </summary>
        protected virtual void ConfigureModules()
        {
            IModuleEnumerator    moduleEnumerator = RootContainer.Services.Get <IModuleEnumerator>();
            IModuleLoaderService moduleLoader     = RootContainer.Services.Get <IModuleLoaderService>();
            IModuleConfigurationLocatorService moduleConfigurationLocator =
                RootContainer.Services.Get <IModuleConfigurationLocatorService>();

            if (moduleEnumerator != null)
            {
                foreach (IModuleInfo moduleInfo in moduleEnumerator.EnumerateModules())
                {
                    System.Configuration.Configuration configuraton =
                        moduleConfigurationLocator.FindModuleConfiguration(moduleInfo.Name);
                    if (configuraton != null)
                    {
                        moduleLoader.FindInitializer(moduleInfo.Name).Configure(RootContainer.Services, configuraton);
                    }
                }
            }
        }