Пример #1
0
        public override int SetSite(Microsoft.VisualStudio.OLE.Interop.IServiceProvider site)
        {
            base.SetSite(site);

            //Initialize a new object to track project document changes so that we can update the StartupFile Property accordingly
            _projectDocListenerForStartupFileUpdates = new ProjectDocumentsListenerForStartupFileUpdates((ServiceProvider)Site, this);
            _projectDocListenerForStartupFileUpdates.Init();

            return VSConstants.S_OK;
        }
Пример #2
0
        public override int Close()
        {
            if (null != _projectDocListenerForStartupFileUpdates) {
                _projectDocListenerForStartupFileUpdates.Dispose();
                _projectDocListenerForStartupFileUpdates = null;
            }
            if (null != Site) {
                LibraryManager libraryManager = Site.GetService(GetLibraryManagerType()) as LibraryManager;
                if (null != libraryManager) {
                    libraryManager.UnregisterHierarchy(InteropSafeHierarchy);
                }
            }
            _watcher.EnableRaisingEvents = false;
            _watcher.Dispose();
            _watcher = null;

            return base.Close();
        }