public void attachCommandEvents(CEBeforeEventHandler before, CEAfterEventHandler after) { cmdEvents = env.Events.CommandEvents; lock(_lock) { cmdEvents.BeforeExecute -= before; cmdEvents.BeforeExecute += before; cmdEvents.AfterExecute -= after; cmdEvents.AfterExecute += after; } }
public void attachCommandEvents(CEBeforeEventHandler before, CEAfterEventHandler after) { cmdEvents = env.Events.CommandEvents; lock (_lock) { cmdEvents.BeforeExecute -= before; cmdEvents.BeforeExecute += before; cmdEvents.AfterExecute -= after; cmdEvents.AfterExecute += after; } }
public void detachCommandEvents(CEBeforeEventHandler before, CEAfterEventHandler after) { if(cmdEvents == null) { return; } lock(_lock) { cmdEvents.BeforeExecute -= before; cmdEvents.AfterExecute -= after; } }
public void detachCommandEvents(CEBeforeEventHandler before, CEAfterEventHandler after) { if (cmdEvents == null) { return; } lock (_lock) { cmdEvents.BeforeExecute -= before; cmdEvents.AfterExecute -= after; } }
private void SubscribeToVsCommandEvents( int eventId, EnvDTE._dispCommandEvents_BeforeExecuteEventHandler beforeExecute = null, EnvDTE._dispCommandEvents_AfterExecuteEventHandler afterExecute = null) { var commandEventGuid = typeof(VSConstants.VSStd97CmdID).GUID.ToString("B"); var targetEvent = DTE.Events.CommandEvents[commandEventGuid, eventId]; if (beforeExecute != null) { targetEvent.BeforeExecute += beforeExecute; } if (afterExecute != null) { targetEvent.AfterExecute += afterExecute; } _subscribedCommandEvents.Add(targetEvent); }