Beispiel #1
0
        private static void InitializeMEFComponents()
        {
            //Import VS components using MEF
            var catalog = new AggregateCatalog(new ComposablePartCatalog[]
            {
                new AssemblyCatalog(Assembly.GetExecutingAssembly()),
                new AssemblyCatalog(typeof(ICodeAnalyzerFactory).Assembly),
                new AssemblyCatalog(typeof(ITextBufferUndoManagerProvider).Assembly)
            });

            //Create the CompositionContainer with the parts in the catalog
            var container = new CompositionContainer(catalog);

            try
            {
                _codeAnalyzerFactory  = container.GetExportedValue <ICodeAnalyzerFactory>();
                _codeFormatterFactory = container.GetExportedValue <ICodeFormatterFactory>();
                _undoManagerProvider  = container.GetExportedValue <ITextBufferUndoManagerProvider>();
            }
            catch (CompositionException)
            {
                throw;
            }
        }
 public VisualizationDataService(ICodeAnalyzerFactory codeAnalyzerFactory, ICodeParserFactory codeParserFactory)
 {
     _codeAnalyzerFactory = codeAnalyzerFactory;
     _codeParserFactory   = codeParserFactory;
 }