public pMixinsOnItemSaveCodeGenerator(IVisualStudioEventProxy visualStudioEventProxy, IVisualStudioCodeGenerator visualStudioCodeGenerator, ICodeGeneratorContextFactory codeGeneratorContextFactory, IpMixinsCodeGeneratorResponseFileWriter responseFileWriter, ITaskFactory taskFactory, ICodeGeneratorDependencyManager codeGeneratorDependencyManager) { _visualStudioCodeGenerator = visualStudioCodeGenerator; _codeGeneratorContextFactory = codeGeneratorContextFactory; _responseFileWriter = responseFileWriter; _taskFactory = taskFactory; _codeGeneratorDependencyManager = codeGeneratorDependencyManager; visualStudioEventProxy.OnProjectItemSaveComplete += (s, a) => GenerateCode(a.ClassFullPath, "ProjectItemSaveComplete"); //Generate code on a Project Item Added incase it's an existing file. visualStudioEventProxy.OnProjectItemAdded += (s, a) => GenerateCode(a.ClassFullPath, "OnProjectItemAdded"); }
private void WireUpVisualStudioEvents(IVisualStudioEventProxy visualStudioEventProxy, ICodeGeneratorDependencyManager codeGeneratorDependencyManager, ISolutionContext solutionContext) { visualStudioEventProxy.OnSolutionClosing += (sender, args) => { _log.Info("Solution closing. Firing OnClearCache"); OnClearCache(this, new EventArgs()); }; visualStudioEventProxy.OnProjectAdded += (sender, args) => { _log.InfoFormat("OnProjectAdded - Evict [{0}]", solutionContext.SolutionFileName); OnEvictFromCache(this, new EvictFromCacheEventArgs(solutionContext.SolutionFileName)); }; visualStudioEventProxy.OnProjectRemoved += (sender, args) => { _log.InfoFormat("OnProjectRemoved - Evict [{0}]", args.ProjectFullPath); OnEvictFromCache(this, new EvictFromCacheEventArgs(args.ProjectFullPath)); _log.InfoFormat("OnProjectRemoved - Evict [{0}]", solutionContext.SolutionFileName); OnEvictFromCache(this, new EvictFromCacheEventArgs(solutionContext.SolutionFileName)); }; visualStudioEventProxy.OnProjectReferenceAdded += (sender, args) => { _log.InfoFormat("OnProjectReferenceAdded - Evict [{0}]", args.ProjectFullPath); OnEvictFromCache(this, new EvictFromCacheEventArgs(args.ProjectFullPath)); //TODO - Evict Project Items - Compilation needs to be updated? }; visualStudioEventProxy.OnProjectReferenceRemoved += (sender, args) => { _log.InfoFormat("OnProjectReferenceRemoved - Evict [{0}]", args.ProjectFullPath); OnEvictFromCache(this, new EvictFromCacheEventArgs(args.ProjectFullPath)); //TODO - Evict Project Items - Compilation needs to be updated? }; visualStudioEventProxy.OnProjectItemSaved += (sender, args) => { _log.InfoFormat("OnProjectItemSaved - Evict [{0}]", args.ClassFullPath); OnEvictFromCache(this, new EvictFromCacheEventArgs(args.ClassFullPath)); codeGeneratorDependencyManager .GetFilesThatDependOn(args.ClassFullPath) .Map(f => { _log.InfoFormat("OnProjectItemSaved - Evict Dependency [{0}]", f.FileName); OnEvictFromCache(this, new EvictFromCacheEventArgs(f.FileName) { FileOnDiskHasChanged = false }); }); }; visualStudioEventProxy.OnProjectItemRemoved += (sender, args) => { _log.InfoFormat("OnProjectItemRemoved - Evict [{0}]", args.ClassFullPath); OnEvictFromCache(this, new EvictFromCacheEventArgs(args.ClassFullPath)); }; visualStudioEventProxy.OnProjectItemRenamed += (sender, args) => { _log.InfoFormat("OnProjectItemRemoved - Evict [{0}]", args.OldClassFileName); OnEvictFromCache(this, new EvictFromCacheEventArgs(args.OldClassFileName)); }; }
private void WireUpVisualStudioEvents(IVisualStudioEventProxy visualStudioEventProxy, ICodeGeneratorDependencyManager codeGeneratorDependencyManager, ISolutionContext solutionContext) { visualStudioEventProxy.OnSolutionClosing += (sender, args) => { _log.Info("Solution closing. Firing OnClearCache"); OnClearCache(this, new EventArgs()); }; visualStudioEventProxy.OnProjectAdded += (sender, args) => { _log.InfoFormat("OnProjectAdded - Evict [{0}]", solutionContext.SolutionFileName); OnEvictFromCache(this, new EvictFromCacheEventArgs(solutionContext.SolutionFileName)); }; visualStudioEventProxy.OnProjectRemoved += (sender, args) => { _log.InfoFormat("OnProjectRemoved - Evict [{0}]", args.ProjectFullPath); OnEvictFromCache(this, new EvictFromCacheEventArgs(args.ProjectFullPath)); _log.InfoFormat("OnProjectRemoved - Evict [{0}]", solutionContext.SolutionFileName); OnEvictFromCache(this, new EvictFromCacheEventArgs(solutionContext.SolutionFileName)); }; visualStudioEventProxy.OnProjectReferenceAdded += (sender, args) => { _log.InfoFormat("OnProjectReferenceAdded - Evict [{0}]", args.ProjectFullPath); OnEvictFromCache(this, new EvictFromCacheEventArgs(args.ProjectFullPath)); //TODO - Evict Project Items - Compilation needs to be updated? }; visualStudioEventProxy.OnProjectReferenceRemoved += (sender, args) => { _log.InfoFormat("OnProjectReferenceRemoved - Evict [{0}]", args.ProjectFullPath); OnEvictFromCache(this, new EvictFromCacheEventArgs(args.ProjectFullPath)); //TODO - Evict Project Items - Compilation needs to be updated? }; visualStudioEventProxy.OnProjectItemSaved += (sender, args) => { _log.InfoFormat("OnProjectItemSaved - Evict [{0}]", args.ClassFullPath); OnEvictFromCache(this, new EvictFromCacheEventArgs(args.ClassFullPath)); codeGeneratorDependencyManager .GetFilesThatDependOn(args.ClassFullPath) .Map(f => { _log.InfoFormat("OnProjectItemSaved - Evict Dependency [{0}]", f.FileName); OnEvictFromCache(this, new EvictFromCacheEventArgs(f.FileName) { FileOnDiskHasChanged = false }); }); }; visualStudioEventProxy.OnProjectItemRemoved += (sender, args) => { _log.InfoFormat("OnProjectItemRemoved - Evict [{0}]", args.ClassFullPath); OnEvictFromCache(this, new EvictFromCacheEventArgs(args.ClassFullPath)); }; visualStudioEventProxy.OnProjectItemRenamed += (sender, args) => { _log.InfoFormat("OnProjectItemRemoved - Evict [{0}]", args.OldClassFileName); OnEvictFromCache(this, new EvictFromCacheEventArgs(args.OldClassFileName)); }; }
public CacheEventHelper(IVisualStudioEventProxy visualStudioEventProxy, ICodeGeneratorDependencyManager codeGeneratorDependencyManager, ISolutionContext solutionContext) { AddEmptyEventHandlers(); WireUpVisualStudioEvents(visualStudioEventProxy, codeGeneratorDependencyManager, solutionContext); }
public CacheEventHelper(IVisualStudioEventProxy visualStudioEventProxy, ICodeGeneratorDependencyManager codeGeneratorDependencyManager, ISolutionContext solutionContext) { AddEmptyEventHandlers(); WireUpVisualStudioEvents(visualStudioEventProxy, codeGeneratorDependencyManager, solutionContext); }