How can “Save All” button press be handled in Visual Studio Extensibility?

前端 未结 1 983
甜味超标
甜味超标 2021-01-26 12:11

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

1条回答
  •  抹茶落季
    2021-01-26 12:35

    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.

    0 讨论(0)
提交回复
热议问题