Ejemplo n.º 1
0
        public void BindEvents()
        {
            EnvDTE.Events events = m_applicationObject.Events;

            m_solutionEvents = (EnvDTE.SolutionEvents)events.SolutionEvents;
            m_buildEvents = (EnvDTE.BuildEvents)events.BuildEvents;
            m_dteEvents = (EnvDTE.DTEEvents)events.DTEEvents;
            m_debuggerEvents = (EnvDTE.DebuggerEvents)events.DebuggerEvents;

            m_solutionEvents.AfterClosing += new _dispSolutionEvents_AfterClosingEventHandler(this.AfterClosing);
            m_solutionEvents.BeforeClosing += new _dispSolutionEvents_BeforeClosingEventHandler(this.BeforeClosing);
            m_solutionEvents.Opened += new _dispSolutionEvents_OpenedEventHandler(this.Opened);
            m_solutionEvents.ProjectAdded += new _dispSolutionEvents_ProjectAddedEventHandler(this.ProjectAdded);
            m_solutionEvents.ProjectRemoved += new _dispSolutionEvents_ProjectRemovedEventHandler(this.ProjectRemoved);
            m_solutionEvents.ProjectRenamed += new _dispSolutionEvents_ProjectRenamedEventHandler(this.ProjectRenamed);
            m_solutionEvents.QueryCloseSolution += new _dispSolutionEvents_QueryCloseSolutionEventHandler(this.QueryCloseSolution);
            m_solutionEvents.Renamed += new _dispSolutionEvents_RenamedEventHandler(this.Renamed);

            m_buildEvents.OnBuildBegin += new _dispBuildEvents_OnBuildBeginEventHandler(this.OnBuildBegin);
            m_buildEvents.OnBuildDone += new _dispBuildEvents_OnBuildDoneEventHandler(this.OnBuildDone);
            m_buildEvents.OnBuildProjConfigBegin += new _dispBuildEvents_OnBuildProjConfigBeginEventHandler(this.OnBuildProjConfigBegin);
            m_buildEvents.OnBuildProjConfigDone += new _dispBuildEvents_OnBuildProjConfigDoneEventHandler(this.OnBuildProjConfigDone);

            m_dteEvents.ModeChanged += new _dispDTEEvents_ModeChangedEventHandler(this.DTEModeChanged);

            m_debuggerEvents.OnEnterRunMode += new _dispDebuggerEvents_OnEnterRunModeEventHandler(DebuggerOnEnterRunMode);
            m_debuggerEvents.OnEnterDesignMode += new _dispDebuggerEvents_OnEnterDesignModeEventHandler(DebuggerOnEnterDesignMode);
        }
Ejemplo n.º 2
0
        /// <summary>Implements the OnConnection method of the IDTExtensibility2 interface. Receives notification that the Add-in is being loaded.</summary>
        /// <param term='application'>Root object of the host application.</param>
        /// <param term='connectMode'>Describes how the Add-in is being loaded.</param>
        /// <param term='addInInst'>Object representing this Add-in.</param>
        /// <seealso class='IDTExtensibility2' />
        public void OnConnection(object application, ext_ConnectMode connectMode, object addInInst, ref Array custom)
        {
            _applicationObject = (DTE2)application;
            _addInInstance = (AddIn)addInInst;
            //MessageBox.Show("Hello");

            OutputWindow outputWindow = (OutputWindow)_applicationObject.Windows.Item(Constants.vsWindowKindOutput).Object;
            outputWindowPane = outputWindow.OutputWindowPanes.Item("Debug");
            //outputWindowPane.OutputString("Hello World!");

            debugEvents = _applicationObject.Events.DebuggerEvents;
            debugEvents.OnEnterRunMode += OnEnterRunMode;
            debugEvents.OnEnterDesignMode += OnEnterDesignMode;
        }
Ejemplo n.º 3
0
 public void UnbindEvents()
 {
     if (m_solutionEvents != null)
     {
         m_solutionEvents.AfterClosing -= new _dispSolutionEvents_AfterClosingEventHandler(this.AfterClosing);
         m_solutionEvents.BeforeClosing -= new _dispSolutionEvents_BeforeClosingEventHandler(this.BeforeClosing);
         m_solutionEvents.Opened -= new _dispSolutionEvents_OpenedEventHandler(this.Opened);
         m_solutionEvents.ProjectAdded -= new _dispSolutionEvents_ProjectAddedEventHandler(this.ProjectAdded);
         m_solutionEvents.ProjectRemoved -= new _dispSolutionEvents_ProjectRemovedEventHandler(this.ProjectRemoved);
         m_solutionEvents.ProjectRenamed -= new _dispSolutionEvents_ProjectRenamedEventHandler(this.ProjectRenamed);
         m_solutionEvents.QueryCloseSolution -= new _dispSolutionEvents_QueryCloseSolutionEventHandler(this.QueryCloseSolution);
         m_solutionEvents.Renamed -= new _dispSolutionEvents_RenamedEventHandler(this.Renamed);
         m_solutionEvents = null;
     }
     if (m_buildEvents != null)
     {
         m_buildEvents.OnBuildBegin -= new _dispBuildEvents_OnBuildBeginEventHandler(this.OnBuildBegin);
         m_buildEvents.OnBuildDone -= new _dispBuildEvents_OnBuildDoneEventHandler(this.OnBuildDone);
         m_buildEvents.OnBuildProjConfigBegin -= new _dispBuildEvents_OnBuildProjConfigBeginEventHandler(this.OnBuildProjConfigBegin);
         m_buildEvents.OnBuildProjConfigDone -= new _dispBuildEvents_OnBuildProjConfigDoneEventHandler(this.OnBuildProjConfigDone);
         m_buildEvents = null;
     }
     if (m_dteEvents != null)
     {
         m_dteEvents.ModeChanged -= new _dispDTEEvents_ModeChangedEventHandler(this.DTEModeChanged);
         m_dteEvents = null;
     }
     if (m_debuggerEvents != null)
     {
         m_debuggerEvents.OnEnterRunMode -= new _dispDebuggerEvents_OnEnterRunModeEventHandler(DebuggerOnEnterRunMode);
         m_debuggerEvents.OnEnterDesignMode -= new _dispDebuggerEvents_OnEnterDesignModeEventHandler(DebuggerOnEnterDesignMode);
         m_debuggerEvents = null;
     }
 }
Ejemplo n.º 4
0
        /// <summary>
        /// Initialization of the package; this method is called right after the package is sited, so this is the place
        /// where you can put all the initilaization code that rely on services provided by VisualStudio.
        /// </summary>
        protected override void Initialize()
        {
            base.Initialize();

            DTE2 dte = GetService(typeof(DTE)) as DTE2;
            if (dte != null)
            {
                Events = dte.Events.DebuggerEvents;
            }

            mResetVibration = new Vibration();
            mResetVibration.LeftMotorSpeed = 0;
            mResetVibration.RightMotorSpeed = 0;
        }