private void RegisterForSolutionLevelEvents() { _solutionEvents.ProjectAdded += project => { RegisterForProjectLevelEvents(project.Object as VSProject); OnProjectAdded(this, new ProjectAddedEventArgs { ProjectFullPath = new FilePath(project.FullName) }); }; _solutionEvents.ProjectRemoved += project => { if (string.IsNullOrEmpty(project.FullName)) { return; } UnregisterForProjectLevelEvents(project as VSProject); OnProjectRemoved(this, new ProjectRemovedEventArgs { ProjectFullPath = new FilePath(project.FullName) }); }; _solutionEvents.BeforeClosing += () => OnSolutionClosing(this, new EventArgs()); _solutionEvents.Opened += () => OnSolutionOpening(this, new EventArgs()); _projectItemsEvents.ItemAdded += item => OnProjectItemAdded(this, new ProjectItemAddedEventArgs { ProjectFullPath = new FilePath(item.ContainingProject.FullName), ClassFullPath = new FilePath(item.GetFullName()) }); _projectItemsEvents.ItemRemoved += item => OnProjectItemRemoved(this, new ProjectItemRemovedEventArgs { ProjectFullPath = new FilePath(item.ContainingProject.FullName), ClassFullPath = new FilePath(item.GetFullName()) }); _projectItemsEvents.ItemRenamed += (item, name) => OnProjectItemRenamed(this, new ProjectItemRenamedEventArgs { ProjectFullPath = new FilePath(item.ContainingProject.FullName), ClassFullPath = new FilePath(item.GetFullName()), OldClassFileName = new FilePath(Path.GetDirectoryName(item.GetFullName()), name) }); _documentEvents.DocumentOpened += item => OnProjectItemOpened(this, new ProjectItemOpenedEventArgs { DocumentReader = new VisualStudioOpenDocumentReader(item), ProjectFullPath = new FilePath(item.ProjectItem.ContainingProject.FullName), ClassFullPath = new FilePath(item.FullName) }); _documentEvents.DocumentClosing += item => OnProjectItemClosed(this, new ProjectItemClosedEventArgs { //ProjectFullPath = item.ProjectItem.ContainingProject.FullName, ClassFullPath = new FilePath(item.FullName) }); _documentEvents.DocumentSaved += item => { var args = new ProjectItemSavedEventArgs { ProjectFullPath = new FilePath(item.ProjectItem.ContainingProject.FullName), ClassFullPath = new FilePath(item.FullName) }; OnProjectItemSaved(this, args); OnProjectItemSaveComplete(this, args); }; _buildEvents.OnBuildBegin += (scope, action) => OnBuildBegin(this, new VisualStudioBuildEventArgs { Scope = scope, BuildAction = action }); _buildEvents.OnBuildDone += (scope, action) => OnBuildDone(this, new VisualStudioBuildEventArgs { Scope = scope, BuildAction = action }); }
public void FireOnProjectItemSaved(object sender, ProjectItemSavedEventArgs eventArgs) { _log.Info("OnProjectItemSaved"); if (null != OnProjectItemSaved) OnProjectItemSaved(sender, eventArgs); _log.Info("OnProjectItemSaveComplete"); if (null != OnProjectItemSaveComplete) OnProjectItemSaveComplete(sender, eventArgs); }
private void RegisterForSolutionLevelEvents() { _solutionEvents.ProjectAdded += project => { RegisterForProjectLevelEvents(project.Object as VSProject); OnProjectAdded(this, new ProjectAddedEventArgs { ProjectFullPath = new FilePath(project.FullName) }); }; _solutionEvents.ProjectRemoved += project => { if (string.IsNullOrEmpty(project.FullName)) return; UnregisterForProjectLevelEvents(project as VSProject); OnProjectRemoved(this, new ProjectRemovedEventArgs { ProjectFullPath = new FilePath(project.FullName) }); }; _solutionEvents.BeforeClosing += () => OnSolutionClosing(this, new EventArgs()); _solutionEvents.Opened += () => OnSolutionOpening(this, new EventArgs()); _projectItemsEvents.ItemAdded += item => OnProjectItemAdded(this, new ProjectItemAddedEventArgs { ProjectFullPath = new FilePath(item.ContainingProject.FullName), ClassFullPath = new FilePath(item.GetFullName()) }); _projectItemsEvents.ItemRemoved += item => OnProjectItemRemoved(this, new ProjectItemRemovedEventArgs { ProjectFullPath = new FilePath(item.ContainingProject.FullName), ClassFullPath = new FilePath(item.GetFullName()) }); _projectItemsEvents.ItemRenamed += (item, name) => OnProjectItemRenamed(this, new ProjectItemRenamedEventArgs { ProjectFullPath = new FilePath(item.ContainingProject.FullName), ClassFullPath = new FilePath(item.GetFullName()), OldClassFileName = new FilePath(Path.GetDirectoryName(item.GetFullName()), name) }); _documentEvents.DocumentOpened += item => OnProjectItemOpened(this, new ProjectItemOpenedEventArgs { DocumentReader = new VisualStudioOpenDocumentReader(item), ProjectFullPath = new FilePath(item.ProjectItem.ContainingProject.FullName), ClassFullPath = new FilePath(item.FullName) }); _documentEvents.DocumentClosing += item => OnProjectItemClosed(this, new ProjectItemClosedEventArgs { //ProjectFullPath = item.ProjectItem.ContainingProject.FullName, ClassFullPath = new FilePath(item.FullName) }); _documentEvents.DocumentSaved += item => { var args = new ProjectItemSavedEventArgs { ProjectFullPath = new FilePath(item.ProjectItem.ContainingProject.FullName), ClassFullPath = new FilePath(item.FullName) }; OnProjectItemSaved(this, args); OnProjectItemSaveComplete(this, args); }; _buildEvents.OnBuildBegin += (scope, action) => OnBuildBegin(this, new VisualStudioBuildEventArgs {Scope = scope, BuildAction = action}); _buildEvents.OnBuildDone += (scope, action) => OnBuildDone(this, new VisualStudioBuildEventArgs { Scope = scope, BuildAction = action }); }