Exemple #1
0
        public void LoadPlugins()
        {
            var pluginAssemblies = _directoryService.GetAllFilesInDirectory(Config.WorkbenchPluginsDirectory)
                                   .Where(fi => fi.Extension.Equals(".dll"))
                                   .Select(fi => Assembly.LoadFrom(fi.FullName))
                                   .Where(a => a.GetCustomAttribute(typeof(WorkbenchPluginAttribute)) != null)
                                   .ToList();

            foreach (var assembly in pluginAssemblies)
            {
                _loggingService.Info(string.Format("{0} loaded.", assembly.FullName));
                _dependencyInjectionEngine.GenerateAssemblyBindingsForType <IWorkbenchPlugin>(assembly);
            }

            _loadedPlugins.AddRange(_dependencyInjectionEngine.GetAll <IWorkbenchPlugin>()
                                    .Select(p =>
            {
                p.Load();
                return(p);
            }));
        }