public void Initialize(ModuleInfo moduleInfo)
        {
            if (InitialModuleLoadCompleted || moduleInfo.ModuleName.EndsWith("Modules.Splash"))
            {
                DefaultInitializer.Initialize(moduleInfo);
                return;
            }

            ModuleConfigs.Modules.FirstOrDefault(mc => mc.Name == moduleInfo.ModuleName).Module = moduleInfo;

            // All modules pre-loaded?
            if (!(ModuleConfigs.Modules.Any(mc => mc.Module == null)))
            {
                // Sort modules
                ModuleConfigs.Modules = ModuleConfigs.Modules.OrderBy(mc => mc.Order).ToList();

                foreach (var config in ModuleConfigs.Modules)
                {
                    _eventAggregator.GetEvent <SplashInfoUpdateEvent>().Publish(new SplashInfoUpdateEvent {
                        Info = config.Description
                    });
                    Thread.Sleep(1000);                     // Uncomment as you need ;-)
                    DefaultInitializer.Initialize(config.Module);
                }

                InitialModuleLoadCompleted = true;
            }
        }
Ejemplo n.º 2
0
        public void Initialize(ModuleInfo moduleInfo)
        {
            if (initialModuleLoadCompleted)
            {
                defaultInitializer.Initialize(moduleInfo);
                return;
            }

            // register Module in Module-Config-List
            moduleConfigs.Modules.FirstOrDefault(mc => mc.Name == moduleInfo.ModuleName).Module = moduleInfo;

            // All modules pre-loaded?
            if (!(moduleConfigs.Modules.Any(mc => mc.Module == null)))
            {
                // Sort modules
                moduleConfigs.Modules = moduleConfigs.Modules.OrderBy(mc => mc.Order).ToList();

                foreach (var config in moduleConfigs.Modules)
                {
                    defaultInitializer.Initialize(config.Module);
                }

                initialModuleLoadCompleted = true;
            }
        }
Ejemplo n.º 3
0
 void InitializeModule(IModuleInfo moduleInfo)
 {
     if (moduleInfo.State == ModuleState.Initializing)
     {
         _moduleInitializer.Initialize(moduleInfo);
         moduleInfo.State = ModuleState.Initialized;
         RaiseLoadModuleCompleted(moduleInfo, null);
     }
 }
Ejemplo n.º 4
0
        private void InitializeModule(ModuleInfo moduleInfo)
        {
            if (moduleInfo.State != ModuleState.Initializing)
            {
                return;
            }

            m_moduleInitializer.Initialize(moduleInfo);
            moduleInfo.State = ModuleState.Initialized;
            RaiseLoadModuleCompleted(moduleInfo, null);
        }
Ejemplo n.º 5
0
 void LoadModules(IEnumerable <ModuleInfo> moduleInfos)
 {
     foreach (var moduleInfo in moduleInfos)
     {
         if (moduleInfo.State != ModuleState.Initialized)
         {
             moduleInfo.State = ModuleState.Initializing;
             _moduleInitializer.Initialize(moduleInfo);
             moduleInfo.State = ModuleState.Initialized;
         }
     }
 }
Ejemplo n.º 6
0
 /// <summary>
 /// Loads the specified modules.
 /// </summary>
 /// <param name="moduleInfos"><see cref="ModuleInfo"/>.</param>
 protected virtual void LoadModules(IEnumerable <ModuleInfo> moduleInfos)
 {
     foreach (var moduleInfo in moduleInfos)
     {
         if (moduleInfo.State == ModuleState.NotStarted)
         {
             moduleInfo.State = ModuleState.Initializing;
             _moduleInitializer.Initialize(moduleInfo);
             moduleInfo.State = ModuleState.Initialized;
         }
     }
 }
Ejemplo n.º 7
0
        protected virtual void InitializeModules(List <Tuple <Assembly, Type> > moduleAssemblies,
                                                 IDependencyResolver dependencyResolver)
        {
            foreach (var moduleAssembly in moduleAssemblies)
            {
                //TODO: Faut-il vraiment forcer l'existance d'un ModuleItinitializer et throw si non présent
                if (moduleAssembly.Item2 == null)
                {
                    throw new NotImplementedException("The module " + moduleAssembly.Item1.GetName().Name +
                                                      " has no ModuleItinitializer.");
                }

                IModuleInitializer moduleInitializer = CreateModuleInitializerInstance(moduleAssembly.Item2);
                moduleInitializer.Initialize(dependencyResolver);
            }
        }