public pMixinsCodeGeneratorResponseFileWriter(IFileWrapper fileWrapper, IFileReader fileReader, ICodeBehindFileHelper codeBehindFileHelper, IVisualStudioOpenDocumentManager visualStudioOpenDocumentManager) { _fileWrapper = fileWrapper; _fileReader = fileReader; _codeBehindFileHelper = codeBehindFileHelper; _visualStudioOpenDocumentManager = visualStudioOpenDocumentManager; }
public pMixinsCodeGeneratorResponseFileWriter(IFileWrapper fileWrapper, IFileReader fileReader, ICodeBehindFileHelper codeBehindFileHelper, IVisualStudioOpenDocumentManager visualStudioOpenDocumentManager) { _fileWrapper = fileWrapper; _fileReader = fileReader; _codeBehindFileHelper = codeBehindFileHelper; _visualStudioOpenDocumentManager = visualStudioOpenDocumentManager; }
// ReSharper restore NotAccessedField.Local protected override void Initialize() { var sw = Stopwatch.StartNew(); base.Initialize(); //Get copy of current DTE var dte = (DTE)GetService(typeof(DTE)); var dte2 = dte as DTE2; //Create a Visual Studio Writer _visualStudioWriter = new VisualStudioWriter(dte, this); _visualStudioWriter.WriteToStatusBar("Initializing pMixins Code Generator Plug-In"); //Initialize Logging Log4NetInitializer.Initialize(_visualStudioWriter, this); //Get a logger for this class _log = LogManager.GetLogger(MethodBase.GetCurrentMethod().DeclaringType); _log.Info("Initialized Logging"); //create Visual Studio Event Proxy _visualStudioEventProxy = new VisualStudioEventProxy(dte2); //Create CodeBehindFileHelper _codeBehindFileHelper = new CodeBehindFileHelper(dte2, typeof(pMixinsEmptySingleFileCodeGenerator).Name); _dteSolutionFileReader = new SolutionDTEReader(dte2); //Initialize the IoC Kernel ServiceLocator.Initialize(_visualStudioWriter, _visualStudioEventProxy, _codeBehindFileHelper, _dteSolutionFileReader); _log.Info("Initialized Kernel"); InitializeSolutionContext(dte); InitializeFileGenerators(); #if DEBUG _eventProxyLogger = ServiceLocator.Kernel.Get <VisualStudioEventProxyLogger>(); #endif _visualStudioWriter.WriteToStatusBar("Initializing pMixins Code Generator Plug-In ... Complete"); _log.InfoFormat("Initialization Complete in [{0}] ms", sw.ElapsedMilliseconds); }
public static void Initialize(IVisualStudioWriter visualStudioWriter, IVisualStudioEventProxy visualStudioEventProxy, ICodeBehindFileHelper codeBehindFileHelper, ISolutionFileReader dteSolutionFileReader) { Kernel = new StandardKernel( new StandardModule(), new pMixinsStandardModule()); Kernel.Bind<IVisualStudioWriter>().ToMethod(c => visualStudioWriter).InSingletonScope(); Kernel.Bind<IVisualStudioEventProxy>().ToMethod(c => visualStudioEventProxy).InSingletonScope(); Kernel.Bind<ICodeBehindFileHelper>().ToMethod(c => codeBehindFileHelper); Kernel.Rebind<ISolutionFileReader>().ToMethod(c => dteSolutionFileReader); LoggingActivity.Initialize(visualStudioWriter); //Make sure the VisualStudioOpenDocumentManager loads early Kernel.Get<IVisualStudioOpenDocumentManager>(); }
public override void MainSetup() { TestSpecificKernel = KernelFactory.BuildDefaultKernelForTests(); EventProxy = TestSpecificKernel.Get <IVisualStudioEventProxy>() //This is important, if the casting isn't done, then EventProxy isn't returned via IoC as TestVisualStudioEventProxy; _MockFileWrapper = BuildMockFileReader(); TestSpecificKernel.Rebind <IFileWrapper>().ToMethod(c => _MockFileWrapper); _MockMicrosoftBuildProjectLoader = BuildMockMicrosoftBuildProjectLoader(); TestSpecificKernel.Rebind <IMicrosoftBuildProjectLoader>().ToMethod(c => _MockMicrosoftBuildProjectLoader); _MockCodeBehindFileHelper = BuildMockCodeBehindFileHelper(); TestSpecificKernel.Rebind <ICodeBehindFileHelper>().ToMethod(c => _MockCodeBehindFileHelper); _MockSolution = new MockSolution(); //Set solution context TestSpecificKernel.Get <ISolutionContext>().SolutionFileName = _MockSolution.FileName; }
public override void MainSetup() { TestSpecificKernel = KernelFactory.BuildDefaultKernelForTests(); EventProxy = TestSpecificKernel.Get<IVisualStudioEventProxy>() //This is important, if the casting isn't done, then EventProxy isn't returned via IoC as TestVisualStudioEventProxy; _MockFileWrapper = BuildMockFileReader(); TestSpecificKernel.Rebind<IFileWrapper>().ToMethod(c => _MockFileWrapper); _MockMicrosoftBuildProjectLoader = BuildMockMicrosoftBuildProjectLoader(); TestSpecificKernel.Rebind<IMicrosoftBuildProjectLoader>().ToMethod(c => _MockMicrosoftBuildProjectLoader); _MockCodeBehindFileHelper = BuildMockCodeBehindFileHelper(); TestSpecificKernel.Rebind<ICodeBehindFileHelper>().ToMethod(c => _MockCodeBehindFileHelper); _MockSolution = new MockSolution(); //Set solution context TestSpecificKernel.Get<ISolutionContext>().SolutionFileName = _MockSolution.FileName; }
public static void Initialize(IVisualStudioWriter visualStudioWriter, IVisualStudioEventProxy visualStudioEventProxy, ICodeBehindFileHelper codeBehindFileHelper, ISolutionFileReader dteSolutionFileReader) { Kernel = new StandardKernel( new StandardModule(), new pMixinsStandardModule()); Kernel.Bind <IVisualStudioWriter>().ToMethod(c => visualStudioWriter).InSingletonScope(); Kernel.Bind <IVisualStudioEventProxy>().ToMethod(c => visualStudioEventProxy).InSingletonScope(); Kernel.Bind <ICodeBehindFileHelper>().ToMethod(c => codeBehindFileHelper); Kernel.Rebind <ISolutionFileReader>().ToMethod(c => dteSolutionFileReader); LoggingActivity.Initialize(visualStudioWriter); //Make sure the VisualStudioOpenDocumentManager loads early Kernel.Get <IVisualStudioOpenDocumentManager>(); }