Inheritance: IVsRunningDocTableEvents, IVsRunningDocTableEvents2, IVsRunningDocTableEvents3, IVsRunningDocTableEvents4, IDisposable
Exemple #1
0
            public WindowFrameInfo(IVsWindowFrame windowFrame, RunningDocTableEvents runningDocTableEvents)
            {
                ErrorHelper.ThrowIsNull(windowFrame, nameof(windowFrame));
                ThreadHelper.ThrowIfNotOnUIThread();

                _runningDocTableEvents = runningDocTableEvents;
                OnScreen    = true;
                WindowFrame = windowFrame;
#pragma warning disable VSSDK002 // Visual Studio service should be used on main thread explicitly.
                var windowFrame2 = (IVsWindowFrame2)windowFrame;
                ErrorHelper.ThrowOnFailure(windowFrame2.Advise(this, out _cookie));
#pragma warning restore VSSDK002 // Visual Studio service should be used on main thread explicitly.
                _runningDocTableEvents.OnDocumentWindowOnScreenChanged(this, true);
            }
Exemple #2
0
      public WindowFrameInfo(IVsWindowFrame windowFrame, RunningDocTableEvents runningDocTableEvents)
      {
        ErrorHelper.ThrowIsNull(windowFrame, nameof(windowFrame));
        ThreadHelper.ThrowIfNotOnUIThread();

        _runningDocTableEvents = runningDocTableEvents;
        OnScreen = true;
        WindowFrame = windowFrame;
#pragma warning disable VSSDK002 // Visual Studio service should be used on main thread explicitly.
        var windowFrame2 = (IVsWindowFrame2)windowFrame;
        ErrorHelper.ThrowOnFailure(windowFrame2.Advise(this, out _cookie));
#pragma warning restore VSSDK002 // Visual Studio service should be used on main thread explicitly.
        _runningDocTableEvents.OnDocumentWindowOnScreenChanged(this, true);
      }
        /// <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>
        protected override void Initialize()
        {
            base.Initialize();
              Debug.Assert(Instance == null);
              Instance = this;

              _runningDocTableEventse = new RunningDocTableEvents();
              SubscibeToSolutionEvents();

              if (_objectManagerCookie == 0)
              {
            _library = new Library();
            var objManager = this.GetService(typeof(SVsObjectManager)) as IVsObjectManager2;

            if (null != objManager)
              ErrorHandler.ThrowOnFailure(objManager.RegisterSimpleLibrary(_library, out _objectManagerCookie));
              }
        }
        protected override void Dispose(bool disposing)
        {
            try
              {
            foreach (var server in _servers)
              server.Dispose();

            UnsubscibeToSolutionEvents();
            _runningDocTableEventse?.Dispose();
            _runningDocTableEventse = null;

            var objManager = GetService(typeof(SVsObjectManager)) as IVsObjectManager2;
            if (objManager != null)
              objManager.UnregisterLibrary(_objectManagerCookie);
              }
              finally
              {
            base.Dispose(disposing);
              }
        }