Example #1
0
        ///
        public override void Initialize()
        {
            base.Initialize();

            LoadUserInfos();

            // Load modules
            GlobalContainer.LoadComponents <IClientModule>(TypeLoadFilter);
            GlobalContainer.LoadComponents <IModuleShell>(TypeLoadFilter);

            // Get types
            var moduleTypes = GlobalContainer.GetRegisteredImplementations(typeof(IClientModule));
            var shellTypes  = GlobalContainer.GetRegisteredImplementations(typeof(IModuleShell)).ToArray();

            // Get assemblies
            Assemblies.AddRange(moduleTypes.Union(shellTypes).Distinct().Select(t => t.Assembly).Distinct().ToList());

            // Raise load event for AssemblyConfiguration
            RaiseAssemblyConfigurationLoaded(new AssemblyConfiguration
            {
                Assemblies = Assemblies.Select(m => new AssemblyConfig(Path.GetFileName(m.Location))).ToList()
            });

            // Raise AssemblyLoaded event for earch assembly
            foreach (var module in Assemblies)
            {
                RaiseAssemblyLoaded(new AssemblyConfig(Path.GetFileName(module.Location)));
            }

            RaiseAssembliesLoaded(Assemblies);
        }