public override void OnToolWindowCreated() { var codeNavToolWindowPackage = Package as CodeNavToolWindowPackage; _dte = (DTE)codeNavToolWindowPackage.GetServiceHelper(typeof(DTE)); var componentModel = (IComponentModel)codeNavToolWindowPackage.GetServiceHelper(typeof(SComponentModel)); _workspace = componentModel.GetService <VisualStudioWorkspace>(); // Wire up references for the event handlers _documentEvents = _dte.Events.DocumentEvents; _documentEvents.DocumentSaved += DocumentEvents_DocumentSaved; _windowEvents = _dte.Events.WindowEvents; _windowEvents.WindowActivated += WindowEvents_WindowActivated; _control.ShowWaitingForDocument(); }
public override void OnToolWindowCreated() { var codeNavToolWindowPackage = Package as CodeNavToolWindowPackage; _workspace = codeNavToolWindowPackage.ComponentModel.GetService <VisualStudioWorkspace>(); if (_control.Dte == null && codeNavToolWindowPackage.DTE != null) { _control.Dte = codeNavToolWindowPackage.DTE; } // Wire up references for the event handlers _documentEvents = codeNavToolWindowPackage.DTE.Events.DocumentEvents; _documentEvents.DocumentSaved += DocumentEvents_DocumentSaved; _documentEvents.DocumentOpened += DocumentEvents_DocumentOpened; _windowEvents = codeNavToolWindowPackage.DTE.Events.WindowEvents; _windowEvents.WindowActivated += WindowEvents_WindowActivated; _control.ShowWaitingForDocument(); }