0

I need to have some action performed when "Save All" button is pressed. If I subscribe to DocumentSaved event that event is invoked once for each unsaved document and this is kind of a problem because I'd rather have the action invoked for the documents collection instead of for each document separately.

Is it possible to handle "Save All" as a single action instead of handling multiple DocumentSaved events?

sharptooth
  • 167,383
  • 100
  • 513
  • 979

1 Answers1

1

You can subscribe to the command execution events with the following code:

events = dte.Events;
commandEvents = events.get_CommandEvents(null, 0);
commandEvents.AfterExecute += OnAfterExecute;

In your OnAfterExecute handler you can check if it is the File.SaveAll command: VSConstants.VSStd97CmdID.SaveSolution.

Sergey Vlasov
  • 26,641
  • 3
  • 64
  • 66