Example #1
0
        public void register_before_event(SSMS_event event_to_register, _dispCommandEvents_BeforeExecuteEventHandler handler)
        {
            CommandEvents ev = _ssms.DTE.Events.get_CommandEvents(event_to_register.guid, event_to_register.id);

            ev.BeforeExecute += new _dispCommandEvents_BeforeExecuteEventHandler(handler);
            _registered_events.Add(ev);
        }
		protected void RegisterHandler(string commandName, _dispCommandEvents_BeforeExecuteEventHandler handler)
		{
			CommandEvents events = mPlugin.FindCommandEvents(commandName);
			if(null == events)
				return;
			events.BeforeExecute += handler;
			mEvents.Add(events);
		}
Example #3
0
        /// ------------------------------------------------------------------------------------
        /// <summary>
        /// Registers the command handler.
        /// </summary>
        /// <param name="nCmdId">The n CMD id.</param>
        /// <param name="cmdHandler">The CMD handler.</param>
        /// ------------------------------------------------------------------------------------
        private void RegisterCommandHandler(int nCmdId,
                                            _dispCommandEvents_BeforeExecuteEventHandler cmdHandler)
        {
            Events        events = DTE.Events;
            CommandEvents cmd    = (CommandEvents)events.get_CommandEvents(
                "{5EFC7975-14BC-11CF-9B2B-00AA00573819}", nCmdId);

            cmd.BeforeExecute += cmdHandler;
            m_commandHandler.Add(nCmdId, cmd);
        }
Example #4
0
 public void RegisterCommand( string guid, int cmdId, _dispCommandEvents_AfterExecuteEventHandler afterHandler, _dispCommandEvents_BeforeExecuteEventHandler beforeHandler)
 {
     cmdEvents[cmdId] = dte.Events.get_CommandEvents(guid, cmdId);
     CommandEvents e = cmdEvents[cmdId];
     if ( e != null)
     {
         e.AfterExecute += afterHandler;
         e.BeforeExecute += beforeHandler;
     }
 }
Example #5
0
        protected void UnregisterHandler(string commandName, _dispCommandEvents_BeforeExecuteEventHandler handler)
        {
            Microsoft.VisualStudio.Shell.ThreadHelper.ThrowIfNotOnUIThread();
            CommandEvents events = mPlugin.FindCommandEvents(commandName);

            if (null == events)
            {
                return;
            }
            events.BeforeExecute -= handler;
        }
Example #6
0
        protected void RegisterHandler(string commandName, _dispCommandEvents_BeforeExecuteEventHandler handler)
        {
            CommandEvents events = mPlugin.FindCommandEvents(commandName);

            if (null == events)
            {
                return;
            }
            events.BeforeExecute += handler;
            mEvents.Add(events);
        }
Example #7
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="guid"></param>
        /// <param name="cmdId"></param>
        /// <param name="afterHandler"></param>
        /// <param name="beforeHandler"></param>
        public void RegisterCommand(string guid, int cmdId, _dispCommandEvents_AfterExecuteEventHandler afterHandler, _dispCommandEvents_BeforeExecuteEventHandler beforeHandler)
        {
            cmdEvents[cmdId] = dte.Events.get_CommandEvents(guid, cmdId);
            CommandEvents e = cmdEvents[cmdId];

            if (e != null)
            {
                e.AfterExecute  += afterHandler;
                e.BeforeExecute += beforeHandler;
            }
        }
Example #8
0
 /// ------------------------------------------------------------------------------------
 /// <summary>
 /// Unregisters the command handler.
 /// </summary>
 /// <param name="nCmdId">The command id.</param>
 /// <param name="cmdHandler">The command handler.</param>
 /// ------------------------------------------------------------------------------------
 private void UnregisterCommandHandler(int nCmdId,
                                       _dispCommandEvents_BeforeExecuteEventHandler cmdHandler)
 {
     ((CommandEvents)m_commandHandler[nCmdId]).BeforeExecute -= cmdHandler;
 }
Example #9
0
 public void register_before_event(SSMS_event event_to_register, _dispCommandEvents_BeforeExecuteEventHandler handler)
 {
     CommandEvents ev = _ssms.DTE.Events.get_CommandEvents(event_to_register.guid, event_to_register.id);
     ev.BeforeExecute += new _dispCommandEvents_BeforeExecuteEventHandler(handler);
     _registered_events.Add(ev);
 }
Example #10
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Unregisters the command handler.
		/// </summary>
		/// <param name="nCmdId">The command id.</param>
		/// <param name="cmdHandler">The command handler.</param>
		/// ------------------------------------------------------------------------------------
		private void UnregisterCommandHandler(int nCmdId,
			_dispCommandEvents_BeforeExecuteEventHandler cmdHandler)
		{
			((CommandEvents)m_commandHandler[nCmdId]).BeforeExecute -= cmdHandler;
		}
Example #11
0
		/// ------------------------------------------------------------------------------------
		/// <summary>
		/// Registers the command handler.
		/// </summary>
		/// <param name="nCmdId">The n CMD id.</param>
		/// <param name="cmdHandler">The CMD handler.</param>
		/// ------------------------------------------------------------------------------------
		private void RegisterCommandHandler(int nCmdId,
			_dispCommandEvents_BeforeExecuteEventHandler cmdHandler)
		{
			Events events = DTE.Events;
			CommandEvents cmd = (CommandEvents)events.get_CommandEvents(
				"{5EFC7975-14BC-11CF-9B2B-00AA00573819}", nCmdId);
			cmd.BeforeExecute += cmdHandler;
			m_commandHandler.Add(nCmdId, cmd);
		}