/// <summary> /// Initialize all Visual Studio Objects /// </summary> public void InitializeVsObjects() { Dte = GetService(typeof(SDTE)) as DTE; Dte2 = GetService(typeof(SDTE)) as DTE2; VsSolution = GetService(typeof(SVsSolution)) as IVsSolution; if (Dte2 == null || Dte == null || VsSolution == null) { VsShell = GetService(typeof(SVsShell)) as IVsShell; _shellPropertyEventsHandler = new ShellPropertyEventsHandler(VsShell, InitializeVsObjects); } else { _shellPropertyEventsHandler = null; ToolWindowPane window = FindToolWindow(typeof(NAntRunnerToolWindow), 0, true); _solutionEventsHandler = new SolutionEventsHandler(window.Content as NAntRunnerToolWindowControl); VsSolution.AdviseSolutionEvents(_solutionEventsHandler, out _solutionEventsCookie); } }