コード例 #1
0
ファイル: EnvDteSniffer.cs プロジェクト: 3F/vsCommandEvent
 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;
     }
 }
コード例 #2
0
 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;
     }
 }
コード例 #3
0
 public void detachCommandEvents(CEBeforeEventHandler before, CEAfterEventHandler after)
 {
     if(cmdEvents == null) {
         return;
     }
     lock(_lock) {
         cmdEvents.BeforeExecute -= before;
         cmdEvents.AfterExecute  -= after;
     }
 }
コード例 #4
0
 public void detachCommandEvents(CEBeforeEventHandler before, CEAfterEventHandler after)
 {
     if (cmdEvents == null)
     {
         return;
     }
     lock (_lock) {
         cmdEvents.BeforeExecute -= before;
         cmdEvents.AfterExecute  -= after;
     }
 }
コード例 #5
0
        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);
        }