static VLDocumentViewsManager() { IVsRunningDocumentTable IVsRunningDocumentTable = (IVsRunningDocumentTable)Package.GetGlobalService(typeof(SVsRunningDocumentTable)); DTE = (EnvDTE80.DTE2)Package.GetGlobalService(typeof(EnvDTE.DTE)); if (IVsRunningDocumentTable == null || DTE == null) { throw new InvalidOperationException("Cannot consume VLDocumentViewsManager services."); } lockedDocuments = new HashSet <string>(); lockedDocumentsWaiting = new HashSet <string>(); invisibleWindows = new Dictionary <string, object>(); uint evCookie; // register file open and close events RDTEvents rdtEvents = new RDTEvents(); rdtEvents.FileOpened += new Action <string>(RdtEvents_FileOpened); rdtEvents.FileClosed += new Action <string>(RdtEvents_FileClosed); rdtEvents.FileClosed += new Action <string>(NotifyFileClosed); int hr = IVsRunningDocumentTable.AdviseRunningDocTableEvents(rdtEvents, out evCookie); Marshal.ThrowExceptionForHR(hr); }
/// <summary> /// Initializes the singleton instance of the command. /// </summary> /// <param name="package">Owner package, not null.</param> public static void Initialize(Package package) { Instance = new ConvertHintPathToSolutionDir(package); events = new RDTEvents(); }