public DTEHelper(DTE dte) { this.DTE = dte; Current = this; AppDomain.CurrentDomain.UnhandledException += CurrentDomain_UnhandledException; //System.Windows.Input.Keyboard.AddPreviewKeyDownHandler(System.Windows.Application.Current.MainWindow, new System.Windows.Input.KeyEventHandler(App_KeyDown)); System.Windows.Application.Current.DispatcherUnhandledException += Current_DispatcherUnhandledException; System.Windows.Forms.Application.ThreadException += Application_ThreadException; docEvents = DTE.Events.DocumentEvents; //docEvents.DocumentOpening += DocumentEvents_DocumentOpening; //docEvents.DocumentClosing += VSPackage1Package_DocumentClosing; //VS关闭命令事件 //cmdEvents = DTE.Events.CommandEvents["{5EFC7975-14BC-11CF-9B2B-00AA00573819}", 229]; //cmdEvents.BeforeExecute += cmdEvents_BeforeExecute; //solEvents = DTE.Events.SolutionEvents; //solEvents.Opened += solEvents_Opened; wndEvents = DTE.Events.WindowEvents; wndEvents.WindowActivated += wndEvents_WindowActivated; dteEvents = DTE.Events.DTEEvents; dteEvents.OnStartupComplete += dteEvents_OnStartupComplete; TextViewCreationListener.FileContentChanged += TextViewCreationListener_FileContentChanged; UploadLog(); }
protected override void Initialize() { base.Initialize(); events = new DTEHelper(GetService(typeof(DTE)) as DTE); RegisterOleComponent(); AddCommandBars(); HideToolBars(); }