private void InitializeDTE() { try { __DTE = (DTE)GetService(typeof(DTE)); } catch (Exception) { __DTE = null; } if (__DTE == null) { IVsShell shellService = (IVsShell)this.GetService(typeof(IVsShell)); _dteInitializer = new DteInitializer(shellService, InitializeDTE); } else { _dteInitializer = null; } }