Last active
October 29, 2016 13:15
-
-
Save swwwolf/c80cac88a821d8e5df36 to your computer and use it in GitHub Desktop.
Invoking external tool from the Visual Commander
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
using EnvDTE; | |
using EnvDTE80; | |
public class E : VisualCommanderExt.IExtension | |
{ | |
public void SetSite(EnvDTE80.DTE2 DTE_, Microsoft.VisualStudio.Shell.Package package) | |
{ | |
DTE = DTE_; | |
events = DTE.Events; | |
documentEvents = events.DocumentEvents; | |
documentEvents.DocumentSaved += OnDocumentSaved; | |
} | |
public void Close() | |
{ | |
documentEvents.DocumentSaved -= OnDocumentSaved; | |
} | |
private void OnDocumentSaved(EnvDTE.Document doc) | |
{ | |
if(doc.Language == "C/C++") | |
DTE.ExecuteCommand("Tools.ExternalCommand1"); | |
} | |
private EnvDTE80.DTE2 DTE; | |
private EnvDTE.Events events; | |
private EnvDTE.DocumentEvents documentEvents; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
It will be great to add in OnDocumentSaved method this lines
for focusing back on document instead of output window (I'm too lazy to push F7 after my every Ctrl+S)