Esempio n. 1
0
        private void InitializeDTE()
        {
            IVsShell shellService;

            shellService = ServiceProvider.GlobalProvider.GetService(typeof(SVsShell)) as IVsShell;

            _dteInitializer = new DteInitializer(shellService, () =>
            {
                _dte = ServiceProvider.GlobalProvider.GetService(typeof(DTE)) as DTE;

                _dteInitializer = null;
                _dte2           = ServiceProvider.GlobalProvider.GetService(typeof(DTE)) as DTE2;

                _settingService = new Lazy <IClassOutlineSettingsProvider>(() =>
                                                                           ServiceProvider.GlobalProvider.GetService(typeof(IClassOutlineSettingsProvider)) as
                                                                           IClassOutlineSettingsProvider);


                CodeSyncTimerInteral = 1000; // every 2 secs

                addDTEEventHandlers();
                InitializeComponent();


                Application.ResourceAssembly = Assembly.GetExecutingAssembly(); // define our resource assembly

                refreshButton.Click += refreshButton_Click;                     // hook up buttons

                refreshToolWindows();
            });
        }
        /// <summary>
        /// to get the reference of IDE (VS or SSMS)
        /// </summary>
        private void InitializeDTE()
        {
            applicationObject = this.GetService(typeof(SDTE)) as EnvDTE80.DTE2;

            if (applicationObject == null) // The IDE is not yet fully initialized
            {
                var shellService = this.GetService(typeof(SVsShell)) as IVsShell;
                dteInitializer = new DteInitializer(shellService, this.InitializeDTE);
            }
            else
            {
                dteInitializer = null;
            }
        }
        /// <summary>
        /// http://www.mztools.com/articles/2013/MZ2013029.aspx
        /// </summary>
        private void InitializeDTE()
        {
            IVsShell shellService;

            this.dte = this.GetService(typeof(Microsoft.VisualStudio.Shell.Interop.SDTE)) as EnvDTE80.DTE2;

            if (this.dte == null) // The IDE is not yet fully initialized
            {
                shellService        = this.GetService(typeof(SVsShell)) as IVsShell;
                this.dteInitializer = new DteInitializer(shellService, this.InitializeDTE);
            }
            else
            {
                this.dteInitializer = null;
            }
        }
        /// <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 initialization code that rely on services provided by VisualStudio.
        /// </summary>

        private void InitializeDTE()
        {
            IVsShell shellService;

            _dte = this.GetService(typeof(Microsoft.VisualStudio.Shell.Interop.SDTE)) as EnvDTE80.DTE2;

            if (_dte == null) // The IDE is not yet fully initialized
            {
                shellService = this.GetService(typeof(SVsShell)) as IVsShell;
                this.dteInitializer = new DteInitializer(shellService, this.InitializeDTE);
            }
            else
            {
                this.dteInitializer = null;
                _solutionEvents = _dte.Events.SolutionEvents;
                _solutionEvents.Opened += new _dispSolutionEvents_OpenedEventHandler(SolutionEvents_Opened);
                _solutionEvents.Renamed += new _dispSolutionEvents_RenamedEventHandler(SolutionEvents_Renamed);
                _solutionEvents.AfterClosing += new _dispSolutionEvents_AfterClosingEventHandler(SolutionEvents_AfterClosing);
            }
        }
        /// <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 initialization code that rely on services provided by VisualStudio.
        /// </summary>

        private void InitializeDTE()
        {
            IVsShell shellService;

            _dte = this.GetService(typeof(Microsoft.VisualStudio.Shell.Interop.SDTE)) as EnvDTE80.DTE2;

            if (_dte == null) // The IDE is not yet fully initialized
            {
                shellService        = this.GetService(typeof(SVsShell)) as IVsShell;
                this.dteInitializer = new DteInitializer(shellService, this.InitializeDTE);
            }
            else
            {
                this.dteInitializer           = null;
                _solutionEvents               = _dte.Events.SolutionEvents;
                _solutionEvents.Opened       += new _dispSolutionEvents_OpenedEventHandler(SolutionEvents_Opened);
                _solutionEvents.Renamed      += new _dispSolutionEvents_RenamedEventHandler(SolutionEvents_Renamed);
                _solutionEvents.AfterClosing += new _dispSolutionEvents_AfterClosingEventHandler(SolutionEvents_AfterClosing);
            }
        }
        protected override void Initialize()
        {
            IVsShell shellService;

             base.Initialize();

             // Try to retrieve the DTE instance at this point
             InitializeDte();

             // If not retrieved, we must wait for the Visual Studio Shell to be initialized
             if (m_dte == null)
             {
            // Note: if targetting only VS 2015 and higher, we could use this:
            // Microsoft.VisualStudio.Shell.KnownUIContexts.ShellInitializedContext.WhenActivated(() => this.InitializeDte());

            // For VS 2005 and higher, we use this:
            shellService = this.GetService(typeof(Microsoft.VisualStudio.Shell.Interop.SVsShell)) as IVsShell;

            m_dteInitializer = new DteInitializer(shellService, this.InitializeDte);
             }
        }
Esempio n. 7
0
        protected override void Initialize()
        {
            IVsShell shellService;

            base.Initialize();

            // Try to retrieve the DTE instance at this point
            InitializeDte();

            // If not retrieved, we must wait for the Visual Studio Shell to be initialized
            if (m_dte == null)
            {
                // Note: if targetting only VS 2015 and higher, we could use this:
                // Microsoft.VisualStudio.Shell.KnownUIContexts.ShellInitializedContext.WhenActivated(() => this.InitializeDte());

                // For VS 2005 and higher, we use this:
                shellService = this.GetService(typeof(Microsoft.VisualStudio.Shell.Interop.SVsShell)) as IVsShell;

                m_dteInitializer = new DteInitializer(shellService, this.InitializeDte);
            }
        }
        private void InitializeDte()
        {
            m_dte = this.GetService(typeof(Microsoft.VisualStudio.Shell.Interop.SDTE)) as EnvDTE80.DTE2;

             m_dteInitializer = null;
        }
Esempio n. 9
0
        private void InitializeDte()
        {
            m_dte = this.GetService(typeof(Microsoft.VisualStudio.Shell.Interop.SDTE)) as EnvDTE80.DTE2;

            m_dteInitializer = null;
        }