////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
        ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

        void InitialiseEventListeners()
        {
            ThreadHelper.ThrowIfNotOnUIThread();

            //
            // Acquire VisualStudio service references.
            //

            LoggingUtils.PrintFunction();

            EnvDTE.DTE dteService = GetService(typeof(SDTE)) as EnvDTE.DTE;

            IVsShell shellService = GetService(typeof(SVsShell)) as IVsShell;

            IVsDebugger debuggerService = GetService(typeof(IVsDebugger)) as IVsDebugger;

            IVsSolution2 solutionService = GetService(typeof(SVsSolution)) as IVsSolution2;

            IVsMonitorSelection monitorSelectionService = GetService(typeof(IVsMonitorSelection)) as IVsMonitorSelection;

            IDebuggerConnectionService debuggerConnectionService = GetService(typeof(IDebuggerConnectionService)) as IDebuggerConnectionService;

            //
            // Register service listeners.
            //

            if (dteService == null)
            {
                throw new InvalidOperationException("Failed to acquire 'DTE' service");
            }

            if (shellService == null)
            {
                throw new InvalidOperationException("Failed to acquire 'IVsShell' service");
            }

            if (debuggerService == null)
            {
                throw new InvalidOperationException("Failed to acquire 'IVsDebugger' service");
            }

            if (solutionService == null)
            {
                throw new InvalidOperationException("Failed to acquire 'SVsSolution' service");
            }

            if (monitorSelectionService == null)
            {
                throw new InvalidOperationException("Failed to acquire 'IVsMonitorSelection' service");
            }

            m_propertyEventListener = new PropertyEventListener(shellService);

            m_debuggerEventListener = new DebuggerEventListener(dteService, debuggerService, debuggerConnectionService);

            m_solutionEventListener = new SolutionEventListener(dteService, solutionService);

            //
            // Register a new listener to assist finding assemblies placed within the package's current directory.
            //

            m_assemblyResolveListener = new AssemblyResolveListener();
        }
Пример #2
0
    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
    ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////

    void InitialiseEventListeners ()
    {
      // 
      // Acquire VisualStudio service references.
      // 

      LoggingUtils.PrintFunction ();

      DTE dteService = GetService (typeof (SDTE)) as DTE;

      IVsShell shellService = GetService (typeof (SVsShell)) as IVsShell;

      IVsDebugger debuggerService = GetService (typeof (IVsDebugger)) as IVsDebugger;

      IVsSolution2 solutionService = GetService (typeof (SVsSolution)) as IVsSolution2;

      IVsMonitorSelection monitorSelectionService = GetService (typeof (IVsMonitorSelection)) as IVsMonitorSelection;

      IDebuggerConnectionService debuggerConnectionService = GetService (typeof (IDebuggerConnectionService)) as IDebuggerConnectionService;

      // 
      // Register service listeners.
      // 

      if (dteService == null)
      {
        throw new InvalidOperationException ("Failed to acquire 'DTE' service");
      }

      if (shellService == null)
      {
        throw new InvalidOperationException ("Failed to acquire 'IVsShell' service");
      }

      if (debuggerService == null)
      {
        throw new InvalidOperationException ("Failed to acquire 'IVsDebugger' service");
      }

      if (solutionService == null)
      {
        throw new InvalidOperationException ("Failed to acquire 'SVsSolution' service");
      }

      if (monitorSelectionService == null)
      {
        throw new InvalidOperationException ("Failed to acquire 'IVsMonitorSelection' service");
      }

      m_propertyEventListener = new PropertyEventListener (shellService);

      m_debuggerEventListener = new DebuggerEventListener (dteService, debuggerService, debuggerConnectionService);

      m_solutionEventListener = new SolutionEventListener (dteService, solutionService);

      // 
      // Register a new listener to assist finding assemblies placed within the package's current directory.
      // 

      m_assemblyResolveListener = new AssemblyResolveListener ();
    }